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.
Download
- 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
import de.bezier.data.sql.*;
- Your new sketch folder, also called SQLite_example1 should contain one file and one folder
- SQLite_example1.pde
- data
- 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
- code
- data
- SQL.java
- SQLite_example1.pde
- SQLite.java
- (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.
New Library
- 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.
Testing
- That's it!
- Try and run the sketch and verify that you get an output: