[Q] Connect to remote MS-SQL-Server?

The place to discuss anything and everything about running your LiveCode on Android

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
Lyshalia
Posts: 2
Joined: Fri Jul 04, 2014 10:34 am

[Q] Connect to remote MS-SQL-Server?

Post by Lyshalia » Fri Jul 04, 2014 10:43 am

Is it possible with livecode to connect from an android app to a remote MS-SQL-Server?
I don't want to waste my time and find out at the end that it's not possible.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5142
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: [Q] Connect to remote MS-SQL-Server?

Post by Mark » Fri Jul 04, 2014 2:09 pm

hi,

I'm not sure about this, because sockets may not have been implemented completely on Android yet. You can, however, use the get/put URL commands to connect to a PHP script on a server, which in turn would talk to the database.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: [Q] Connect to remote MS-SQL-Server?

Post by Simon » Fri Jul 04, 2014 8:17 pm

Yep, I use it on Android and iOs
put revOpenDatabase( theDBType, theDBHost, theDBName, theDBUser, theDBPassword ) into tDatabaseID
It is connecting through php.
If you have cpanel access to your server it's very easy to set up:
2014-07-04_1215.png
2014-07-04_1215.png (20.43 KiB) Viewed 4428 times
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5142
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: [Q] Connect to remote MS-SQL-Server?

Post by Mark » Fri Jul 04, 2014 8:35 pm

Hi Simon,

If you use it on mobile devices, then I must be wrong saying that it is connected to sockets. I don't understand, however, why you say it is connected through PHP. Does one need to install a PHP script on the server to make it work?

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: [Q] Connect to remote MS-SQL-Server?

Post by Simon » Fri Jul 04, 2014 8:42 pm

Hi Mark,
To tell you the truth I'm not completely sure of how it's done. :oops:
After setting up the mySQL DB via that same control panel then using the phpAdmin and Remote MySQL everything connected just fine when I use revOpenDatabase.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5142
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: [Q] Connect to remote MS-SQL-Server?

Post by Mark » Fri Jul 04, 2014 8:47 pm

Thanks Simon. Apparently, the correct answer is: it has nothing to do with sockets and if your web hosting company allows it, you can connect directly to your on-line database using LiveCode's SQL commands and functions. Note that some web hosts may not allow direct access to databases on shared servers.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

shawnblc
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 338
Joined: Fri Jun 01, 2012 11:11 pm
Location: USA

Re: [Q] Connect to remote MS-SQL-Server?

Post by shawnblc » Sun Jul 06, 2014 1:56 pm

Login to your Cpanel and allow remote connections (see image). Then use php to connect to your database. Use the wildcard % to allow remote connections.
Attachments
Screen Shot 2014-07-06 at 7.54.43 AM.png

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5142
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: [Q] Connect to remote MS-SQL-Server?

Post by Mark » Sun Jul 06, 2014 2:05 pm

Hi,

You may allow remote connections in your CPanel, but even with this option turned on, hosting companies may not allow it.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Lyshalia
Posts: 2
Joined: Fri Jul 04, 2014 10:34 am

Re: [Q] Connect to remote MS-SQL-Server?

Post by Lyshalia » Mon Jul 07, 2014 1:54 pm

Well, I was thinking of a direct connection in my internal network.
Without webserver and no php!
Is there no possibilty to open a direct DB-connection on port 1433 to a remote MS-SQL-Server in the same network?

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5142
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: [Q] Connect to remote MS-SQL-Server?

Post by Mark » Mon Jul 07, 2014 2:05 pm

Hi,

Looking at the dictionary, it seems that all database and SQL commands are supported on Android. I'd think that you can make a direct connection to a database on your own network. Just try it.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

AxWald
Posts: 402
Joined: Thu Mar 06, 2014 2:57 pm

Re: [Q] Connect to remote MS-SQL-Server?

Post by AxWald » Sat Jul 12, 2014 7:16 pm

Hi,
Lyshalia wrote:Is it possible with livecode to connect from an android app to a remote MS-SQL-Server?
(See the bold words ...)

I may be wrong, but I think you'll be forced to use ODBC (of which I don't know yet if it's available on Android). For sure, your MS-SQL server must have TCP/IP registered (not only named pipes), and maybe somewhere there's a switch to allow remote access.
Firewall settings come to mind, too ...

Next problem would be - what's "remote"? From inside the network (LAN or WLAN), or from outside (TCP/IP from the internez, G3 for instance), too? The latter is a dangerous beast, dunno if I'd like to expose my database server ...

In this case I'd recommend a "bridge", like PhP. That communicates with the evil world out there, checks the commands, translates it and sends it to the database. And returns the results, for sure.
Such can be done with a LC standalone, too - this can run nicely on a windows server as a service.

I'm hunting for a solution for a quite similar project, and I'll let you know if I find one.

Have fun!

Post Reply

Return to “Android Deployment”