Page 1 of 1
[Q] Connect to remote MS-SQL-Server?
Posted: Fri Jul 04, 2014 10:43 am
by Lyshalia
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.
Re: [Q] Connect to remote MS-SQL-Server?
Posted: Fri Jul 04, 2014 2:09 pm
by Mark
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
Re: [Q] Connect to remote MS-SQL-Server?
Posted: Fri Jul 04, 2014 8:17 pm
by Simon
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 (20.43 KiB) Viewed 10644 times
Simon
Re: [Q] Connect to remote MS-SQL-Server?
Posted: Fri Jul 04, 2014 8:35 pm
by Mark
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
Re: [Q] Connect to remote MS-SQL-Server?
Posted: Fri Jul 04, 2014 8:42 pm
by Simon
Hi Mark,
To tell you the truth I'm not completely sure of how it's done.
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
Re: [Q] Connect to remote MS-SQL-Server?
Posted: Fri Jul 04, 2014 8:47 pm
by Mark
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
Re: [Q] Connect to remote MS-SQL-Server?
Posted: Sun Jul 06, 2014 1:56 pm
by shawnblc
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.
Re: [Q] Connect to remote MS-SQL-Server?
Posted: Sun Jul 06, 2014 2:05 pm
by Mark
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
Re: [Q] Connect to remote MS-SQL-Server?
Posted: Mon Jul 07, 2014 1:54 pm
by Lyshalia
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?
Re: [Q] Connect to remote MS-SQL-Server?
Posted: Mon Jul 07, 2014 2:05 pm
by Mark
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
Re: [Q] Connect to remote MS-SQL-Server?
Posted: Sat Jul 12, 2014 7:16 pm
by AxWald
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!