Archive for July, 2012

Getting used to SQLite

July 28, 2012

Introduction

Once upon a time, I happened to think SQLite was worth trying. Gave it a shot, but could not figure out where to start. Created some tables and quickly dropped the idea of using it anywhere, because I didn’t know where to go from there.

Recently, I have been a keen admirer of bash scripts. I even started a project (https://github.com/neppramod/spring-mvc) that creates spring 3, hibernate, mysql project using a config file to change almost every aspect of the project. Some day I might even create a separate bash script to run ls. In that project I quickly reached a wall when I could not figure out why the DAO was not working. I have figured out the problem (bloody open sessions) and have created fresh project. I will soon have to convert them to scripts and commit the changes. I might even write an article describing how to change different aspects of the project.

Until that time, we will give some love to sqlite.

SQLite Intro

If you look at http://www.sqlite.org/about.html you will find a line that says “Think of SQLite not as a replacement for Oracle but as a replacement for fopen()”. SQLite is just that. It creates one flat file in the filesystem (which you can view using strings) and writes everything on to it. You just create a file (database file) using some scripts, create tables and are ready to go. You distribute your application with this file and use it to store and access what ever data your application needs (I am not talking about database applications). Lets create a database with a table called todo.

(more…)

Advertisements