Home  »  Articles   »   Getting to Know SQLite for the Absolute Beginner

Getting to Know SQLite for the Absolute Beginner

The problem with relational database server systems such as Oracle, SQL Server, PostgreSQL, MySQL and others is that they require a significant amount of computer resources to function optimally. Enter SQLite the solution initially release back in 2000.

SQLite which began as a Tcl extension was started back in 2000. It was developed by D. Richard Hipp. At the time he was working for General Dynamics on contract with the United States Navy designing software for guided missile destroyers.

What is SQLite?

SQLite is a relational database management system that does not run off as a server in the traditional sense. It is designed to run as a light-weight library written in the C programming language.

Rather than running as a client-server model, SQLite is designed to be embedded into the program with which it is designed to run on. It is therefore widely used and preferred for embedded applications that need some sort of local storage.

The library uses standard Structured Query Language (SQL) to do transactions on the data managed by the library.

The SQLite database format with multiple tables, indices, triggers, and views is contained in a single portable file stored on disk. The cross platform data format can be moved around by simply copying the file. This file is compatible with 32-bit and 64-bit systems. It also works just the same between big-endian and little-endian architectures.

Where Can I Find SQLite?

You can find this versatile library in several places from Desktop applications, Web browsers, smartphones and regular cellphones. You can also find it used in all sorts of hand held devices, portable music players, DVD players and more. The list is endless. You can find it running in as little as 4 KB stack space and as little as 100 KB of available heap.

Being open source and in public domain, this reduces restrictions and makes this embedded database engine free and available to be used by anyone for both commercial and personal uses.

As this library is considered ACID (conforms to the properties of Atomicity, Consistency, Isolation and Durability), it is considered safe to use even when memory allocation failures and disk I/O errors are encountered.

Usage

SQLite is not ideal for use in situations where client-server applications would make more sense. This situations are for example where several clients are performing transactions on the same database server over a network especially where latency is a factor.

High volume websites will not play well with SQLite as opposed to a low volume website. In this case an enterprise class client-server database system like those mentioned in the first paragraph of this article may make more sense.

If you are dealing with high concurrency one reads, it may not be a problem using this library however when using multiple writes you will land into problems trying to rely on it as it supports only one writer instance at a time.

Again using very large datasets may not be what you want out of this library. It may well support a file size up to 140 terabytes, notwithstanding the maximum filesize for the underlying platform. Nevertheless it would not be a good ideal to hod all that data in a single file database.

SQLite however can be ideal for education and training purposes. It can also be used to stand in for more permanent enterprise database systems during demos or prototypes.

It can be used for archival purposes as well as Ad hoc data files. It can also be used for local caching of enterprise data, local storage for websites and many more.

Security

By default SQLite databases are not encrypted nor are they password protected. By this very fact it makes this embedded database not ideal for storing sensitive information off the shelf.

The good news is that there are tools like SQLite Encryption Extension and SQLite Crypt and many other ports that allow users to secure their databases. It is highly recommended to implement those solutions should your application store sensitive data.

You can get a copy of the SQLite source code in all its variants as well as compiled binaries from the official download page.

Ref:
https://www.sqlite.org – Official SQLite Website
https://en.wikipedia.org/wiki/ACID – Definition of ACID
https://www.sqlite.org/cvstrac/wiki?p=SqliteWebSecurity – Web Security
http://stackoverflow.com/questions/1259561/encrypt-sqlite-database-in-c-sharp – SQLite security ports

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.

Available under:
Articles