-1

I would like to know, how to get data from MySQL database to my application without using any REST API or PHP code. I was looking over the internet for the solution for this problem. But they say, you can use php code as REST API and then, can communicate with database. For this purpose, i will need a host and domain. I don't want to use that. Is there any other way to communicate with mysql database. Can i use mysql module of node js in titanium application.

user3619134
  • 31
  • 1
  • 3
  • Titanium provides SQLite database, and you can easily interact with it. – Swanand May 12 '14 at 13:01
  • Where is the MYSQL database? Does it already exist or are you creating it? There is TONS of documentation on how to use Titanium with a SQLite database. – Josiah Hester May 12 '14 at 15:49

2 Answers2

0

There is no way to have direct connection between your mobile client and MySQL database. To retrieve data from MySQL you need to build application which will receive request from your app, retrieve data from MySQL, process and return it as a response.

If you don't want to build mobile and server application at the same time you can try using Appcelerator Cloud service, which plays really nicely with Titanium SDK and allows you to persist users data.

daniula
  • 6,639
  • 4
  • 29
  • 47
0

There are two answers to this problem, depending on your situation:

If Your Data Is Specific to One Device...

If you want to store data locally on one device, and that one device is the only one that will ever use it, then you want to use a SQLite database. This is very commonly used in mobile apps, and is very well documented. If you already have a MySQL database with the schema you want to use, then you could really easily convert it to a SQLite db file.

If Your Data Is Centralized...

If you need to store data remotely, in one central place, that the mobile app can access, then you need to use a remote database.

MySQL is one such option. You say that hosting PHP (which is itself run through something like Apache or IIS) is not something you want to do. But if you can host MySQL somewhere, or run it on a machine that your mobile app can access, then you can also easily host PHP and Apache.

If you don't want to spend money on a domain, then use one of the free dynamic DNS providers, which map a domain name (such as foo.hopto.org) to an IP address. If you don't want to pay for a server, then use your home computer, and keep it on whenever the mobile app needs to access it. There's easy, well documented ways around any of the issues you're having.

Alternatively, as @daniula pointed out, use Appcelerator Cloud Services. Then you can interact with simple objects, and they'll be stored for you in a central server. You can control who can access what data, and more. (Full disclosure -- I work for Appcelerator.)

Community
  • 1
  • 1
Dawson Toth
  • 5,300
  • 2
  • 20
  • 37