Can Corona communicate directly (network) with an SQLite database?

Hi all,
I understand the core APIs and functions associated with Corona’s SQLite implementation: how to access, modify, insert, and delete fields/tables/etc. But can Corona communicate directly with an SQLite database on a server? It seems that the basic implementation is for local databases only… those contained or created within the app’s Documents directory. I can not locate any methods to “connect” to a hosted database to download NEW data into the app’s local database.

If this is true, I suppose the best method might be to download the entire hosted database into the app’s Documents directory using FTP or another file download API, overwrite the current one, then process the data from there?

I’m hoping that there’s a more efficient method… some method to just cherry-pick new or updated data from a server-side database and bring it into the Corona app.

Any ideas or suggestions? Third-party code modules that can handle this?

Thanks!
Brent Sorrentino [import]uid: 9747 topic_id: 28257 reply_id: 328257[/import]

Hi Brent,

SQLite isn’t really designed for networked or hosted use. If that’s what you need, then you’re better off looking at a more full-featured server-side DB like MongoDB or CouchDB.

You can connect directly to CouchDB using HTTP calls, so that might be the easiest. You can get a free hosted DB using Cloudant (www.cloudant.com).

If you let us know what you’re trying to achieve, we might be able to give you some more helpful pointers on how to get it done.

Ali [import]uid: 10499 topic_id: 28257 reply_id: 114168[/import]

Thanks for the info Ali!

The most “simple” summary of what I’m looking for, at least initially, is a basic store inventory: an actual store with a real inventory that wants to display it via a free app. There isn’t alot of inventory, but it changes frequently. Items get sold daily, new items arrive daily, and the client would like to reflect this in the app. So, I would ideally like to achieve this using a database, where the app users connect and the inventory is changed on their actual device. Fortunately, this concept is simplified because users don’t need to send any data back to the server-side database, they would only receive it.

Have you done any specific Corona interactivity using MongoDB or CouchDB? Using Corona’s HTTP calls to fetch data? Can you manipulate these databases using standard SQL functions, i.e. a web-based application that I would design for the client to manage the inventory?

Again, thanks for your tips, I’ll check out these database options a.s.a.p.

Brent
[import]uid: 9747 topic_id: 28257 reply_id: 114224[/import]

Brent, the Corona SDK SQLlite library only works with local databases.

If you want to work with something on a server, there are several options, like Amazon’s simpleDB product (if you can figure out their API). Parse also offers a simple to use REST based API to their database services and someone has a Parse library in the community code.

However, if you are doing this for an existing business, they likely already have a database for their inventory if they have web sites accessing it already. It could be anywhere from a MySQL database to an Oracle database. They also likely have some language of choice for having their website access the database, like PHP or ASP or .NET services.

If they don’t and they don’t want the on-going costs involved with Parse and such, they might want to host their own MySQL database and put it on a LAMP (Linux, Apache, MySQL, PHP) server. Then you can create your own setup. You can start here for more information:

http://omnigeek.robmiracle.com/2012/04/15/using-corona-sdk-with-rest-api-services/

[import]uid: 19626 topic_id: 28257 reply_id: 114251[/import]

Much appreciated Rob!

I will study your documentation exhaustively about how to accomplish this. The client has a standard Access database linked up to a Cold Fusion web store, but I should be able to connect to that database using HTTP “get”. I’ll tinker around with it and come to some reasonable solution… the app is question is not really that intensive, i.e. it doesn’t need to actually be a “live store” based on their inventory, but rather just a representation of the new/current inventory which the store updates each day/hour and users of the app can see that.

Thanks,
Brent
[import]uid: 9747 topic_id: 28257 reply_id: 114397[/import]