Connect to remote SQL database

doug 8 years ago updated by John Heryer 8 years ago 7
In your documentation, you show how to connect to a local SQL database, but how would you go about connecting to a remote SQL database? What types of credentials do you need?
Hey guys,

I'm trying to do the same thing, but I'm have trouble getting it to connect. Here's what my code looks like:

<datasource name="favoritesdb-list" source="https://argyletesting:pass123@data.argyleapp.com/" query="SELECT * FROM a64744 ORDER BY NAME ASC;" providertype="sql"/>

But when I open the app, I get an alert saying "Database Error: no such table:a64744"

I know the 'a64744' table exists in the 'argyle' database at data.argyleapp.com, but I'm getting this error. I've also tried additional pathing like data.argyleapp.com/argyle and data.argyleapp.com/argyle/a64744, but nothing seems to work. (I'm also tried with 'http' and 'https'.) I'm a SQL noob, do you have any ideas what I'm doing wrong?

Tyler, can you confirm that you can gain access on the web with your username and pass credentials?
Shoot. The password is 123pass (feel free to log in to check out the backend yourself). Either way the problem persists. (It wasn't working for my *real* login info, and I just changed that info before posting.)

Updated code:
<datasource name="favoritesdb-list" source="https://argyletesting:123pass@data.argyleapp.com/" query="SELECT * FROM a64744 ORDER BY NAME ASC;" providertype="sql"/>
You can't connect to remote sql databases. I recommend creating a web service you can get/post requests to using datasources.

This now appears to be the case. External SQL datasources can't connect through WIRE. Looks like you might have to take a different approach with JSON or onboard SQL
Ah, ok. I'm looking to pass read-only information to an internal SQL database, so this isn't a huge obstacle.

I could type up my SQL command to create the entire table and save it in an XML or JSON file, pass it through the WIRE, and have my internal SQL database query it (recreating the table locally). Does that sound like a terrible hack? Is there a better way to pass a remote-hosted string of text to WIRE?

Alternatively, can I tell my app to just download a remote file on command (it would be XML) and store it locally to be used as a datasource?

(Sorry for spamming your inbox, Doug!) :)
The simple solution is to use a json datasource to pull a json feed from a web server. You can then populate the local database with the data from that feed.

This tutorial maybe overkill for what you are trying to do: