DB Lib is a minimalistic database library for LiveCode that works on Desktop and Mobile and allows you to build database-savvy apps without writing SQL directly. This post is to introduce a great new feature called Remote DB Lib. As you may know from posts on the How To Use LiveCode mailing list and forums, many developers would like to use DB Lib in their apps over the internet. Like all other database libraries that work on top of RevDB, DB Lib (until today) needed to connect directly to the database server to work and this is not a good solution for apps that work over the internet since exposing MySQL to the internet at large is a huge security risk.

Today I am releasing the first version of a drop-in replacement library called Remote DB Lib. This new library has the same API as the current DB Lib but instead of working on top of RevDB, it works alongside a matching PHP file on your server, it is this PHP file that actually talks to the database server. The Remote DB Lib picks all your DB Lib calls and packs it on an encrypted message that is sent to the PHP file where it is decrypted and executed. This library is using state of the art AES 256 encryption (you can also add a free SSL certificate from Let's Encrypt to add even more security) to protect your data.

Using it is very simple, you just add your database configuration data to the PHP file, customize the encryption key used in both the PHP file and your LiveCode setup and you're good to go, for example, this is the LiveCode setup:

put "https://andregarzia.com/auxiliary/dblibserver.php" into tConfigA["url"] // URL
put "FFFFFFFFFFFFDDCCFFFFFFFFFFFFDDCC" into tConfigA["encryption_key"] // Encryption Key
dbSetDefaultConnectionConfiguration tConfigA

and on the PHP file we have:

// Override the data below with your defaults
$encryption_key = "FFFFFFFFFFFFDDCCFFFFFFFFFFFFDDCC"; // Same as LiveCode side
$user = "test_user"; // customize user, password, db...
$password = "mypassword";
$db = "test";
$server = "localhost";
$cipher = "AES-256-CTR"; // do not change cipher unless you know what you're doing

After configuring them, you can just issue normal DB Lib commands such as:

put dbGet("test_contacts") into tRetValA
put jsonexport(tRetValA) into fld 1

This new library is a part of DB Lib product, so all current customers will just get it. If you don't have a license for DB Lib, you can purchase it for USD 60 below:

I hope you all enjoy the new safety provided by this enhancement! Andre Garzia