Tutorial: SQLite and Processing, Part I
--D. Thiebaut 14:41, 30 June 2011 (EDT)
This is a simple series of steps to get something going with SQLite and Processing. It is based on the library available from bezier.de/processing/libs/sql/#download, which is available here for redundancy.
- Go to http://bezier.de/processing/libs/sql/#download and download the SQLibrary-0.1.0.zip
New PDE sketch
- Unzip the SQLibrary and copy the examples/SQLite_example1 folder into a new location. This will become the sketch you'll be using to test SQLite and Processing.
- Edit the pde file and comment out the line
- Your new sketch folder, also called SQLite_example1 should contain one file and one folder
- the data folder should contain an SQLite database called test.db
New Java Classes
- Locate the SQL.java and SQLite.java programs in the source, de, bezier, data, sql folders, and copy them to the new SQLite_example1 folder.
- This folder should now contain
- (folders appear in italics)
- Edit the two java programs and remove the package line.
- Futhermore, change the declaration of the class in SQLite.java to read
public class SQLite extends SQL
- The two modified files are available here.
- copy the file sqlitejdbc-v053-pure.jar from the library folder of the unzipped archive you downloaded, and copy it into the code folder in your sketch folder.
|Note that the sketch also works with the newer sqlitejdbc-v056.jar file available from www.zentus.com/sqlitejdbc.|
- That's it!
- Try and run the sketch and verify that you get an output, as illustrated below.
- You may want to move on to Tutorial 2 to see how to run this in Eclipse.