Remote DB Lib

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.

This is 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 "" 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.

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

Download & Purchase

DB Lib is a dual licensed library. Commercial licenses can be purchased for GBP 60 by clicking the button below.

Those looking for the GPL version, can download the release from the releases page.

Don’t miss the bundle

There is now a bundle of the LiveCode Advanced Architecture Book, Network Tracer, AAG | Tools plugin collection and DBLib for the discounted price of GBP 100, this is 30% off the normal price. You can get all the plugins from AAG | Tools plus the most developer friendly database library, plus the new Network Tracer together in this bundle. To take advantage of this bundle, use the buy now button below: