LiteDAC

Connecting in Direct Mode

LiteDAC Professional Edition allows to connect to SQLite in two ways: with using SQLite client library, or in Direct mode by linking SQLite library statically in an application. The chosen connection mode is regulated by the TLiteConnection.Options.Direct property.

LiteDAC connection modes

By default, LiteDAC, like most applications that work with SQLite, uses the SQLite client library (sqlite3.dll for Windows, libsqlite3.dylib for MacOS and libsqlite3.so for Linux) to connect to a SQLite database. This is referred to as connecting in Client mode, and it is the usual way to develop SQLite applications with a third-generation language. All SQLite API routines are stored in external library, so the executables for applications, that work using SQLite client, are a bit smaller. However, working in Client mode requires SQLite client library to be present on target workstations. It's either may cause compatibility issues of your application and the existent SQLite library, or causes a need to deploy a compatible version of the SQLite client library with your application.

LiteDAC Professional Edition includes an option to connect to SQLite directly, using the embedded SQLite3 engine. This is referred to as connecting in Direct mode. Connecting in Direct mode does not require SQLite client software to be present on target machines and saves your application from compatibility problems. Furthermore, our embedded SQLite3 engine supports built-in database encryption, that gives an ability to work with encrypted databases in Direct mode. The only inconvenience is that the application size increases slightly (about 350 KB).

Setting up Direct mode connections

To connect to SQLite database using Direct mode, set up your Direct property to True. This is all you need to do to enable Direct mode connections in your application. You do not have to rewrite other parts of your code.

To return to working through SQLite client software, just set the Direct property to False.

Note: Direct mode is available in LiteDAC Professional Edition, and can be evaluated with LiteDAC Trial Edition.

Advantages of using Direct mode

Connecting in Direct mode is managed transparently by the TLiteConnection object, and you can easily return to connecting via SQLite client library in Client mode at any time, if the restrictions above become critical for you.

Disabling Direct Mode

If you don't plan to use Direct Mode in your application, you can permanently disable it.

© 1997-2024 Devart. All Rights Reserved. Request Support DAC Forum Provide Feedback