You will experience future happiness. Embed.
What is SQLite
• Fast, embedded database platform
• Implements all common SQL92 features
• Easy setup, conﬁgure and use
• File-based storage, one database per ﬁle
• Open source and free!
Who uses SQLite?
• Adobe Apollo/AIR - native database
• Mozilla Firefox 3 - bookmarks and history
• Apple Safari 3 - it’s in there
• Apple Mail - Holds all your e-mail
• Google Gears - ofﬂine database in JS
• Self contained database allows fast
deployment of encapsulated solutions
• Using it requires referencing one .NET
assembly that is ADO.NET DB factory
• Easy unit testing. Just delete the ﬁle and
recreate the test
• No server required so you don’t have to
maintain things in two places
• No software to install, just the web
• Lots of quality applications for managing
• Many tools available, accessible remotely
• Supports ACID transactions
atomic, consistent, isolated and durable
• Performance is faster than...
MS SQL, PostgreSQL, XML and MySQL
• Small disk and memory footprint
• Stored procedures, triggers and views
• All the cool kids are using it!
• Easier, smoother and faster deployment
means happier clients and developers
• Zero-cost means better ROI and sales
• Industry-wide support and documentation
• More developer friendly, no need for DBA
• Open standard for interoperability
• Columns types are not enforced
This may be a pro depending on who you are
• Strange string concatenation characters
• Foreign keys are not enforced
• File-based, relies on the ﬁle system for
database level permissions
• Lesser SQL features like FULL OUTER JOIN
When should I use it?
• When the web application IS the server
This includes most apps we have built lately
• Supporting a web site with a basic database
• Building a desktop app that needs ﬁle types
• When storing non-centralized data
This would have been great for storing
patient medical records for portability
When should I avoid it?
• On larger projects where enterprise access
and management is required
• When MS SQL or other is a requirement
• When the database may be accessed by
more than one code base
• When replication or multi-client is needed
How do I use it?
• Include the .NET assembly
• Include the Cltr assembly
• Add a Global.cs with a Connection
property and ﬁle management methods
• Code my classes with an “Ensure” method
• Write my classes as usual
So what’s different?
• Use || instead of + for string concatenation
• Use AUTOINCREMENT instead of IDENTITY
• Use LIMIT and OFFSET instead of TOP
• Use real quotes “” instead of square quotes [ ]
• Use different functions and date/time syntax
• Use sqlite_* not sys* tables
How do I get started?
• SQLite3 - Language, types, functions
• System.Data.SQLite - .NET assembly
• SQLabs - Great admin tool for Mac or PC
http://www.sqlabs.net - not free though
• Other tools - See what I mean? Choices!