I'm looking to call a database from a distant server (the database is not in the app directory but on the web), you know with php you use some function like mysql_connect
try this, http://php.net/manual/en/book.mysql.php
You'd need a MySQL driver for the phone - which might be a problem.
Most people wrap the database in a REST based web service.
The best way to do that is call a php file on your webserver with
Titanium.Network.HTTPClientwhich handles all of the SQL calls then just return the result as a JSON object and load that in to your script with the 'xhr.onload' function of the