Difference between revisions of "Tutorial: SQLite and Processing, Part I"

From dftwiki3
Jump to: navigation, search
 
(2 intermediate revisions by the same user not shown)
Line 7: Line 7:
 
<br/>
 
<br/>
 
<bluebox>
 
<bluebox>
This is a simple series of steps to get something going with SQLite and Processing.  It is based on the library available from [http://bezier.de/processing/libs/sql/#download  bezier.de/processing/libs/sql/#download], which is available [[media:SQLibrary-0.1.0.zip | here]] for redundancy.
+
This is a simple series of steps to get something going with SQLite and Processing.  It is based on the library available from [http://bezier.de/processing/libs/sql/#download  bezier.de/processing/libs/sql/#download], which is available [[media:SQLibrary-0.1.0.zip | here]] for redundancy.<br />[[Tutorial: SQLite and Processing, Part II|Part 2]] takes the same example and creates an Eclipse project with it.
 
</bluebox>
 
</bluebox>
  
Line 47: Line 47:
 
<br />
 
<br />
 
<br />
 
<br />
<tanbox>'''Note''' that the sketch also works with the newer '''sqlitejdb-v056.jar''' file available from [http://www.zentus.com/sqlitejdbc/ www.zentus.com/sqlitejdbc].
+
<tanbox>'''Note''' that the sketch also works with the newer '''sqlitejdbc-v056.jar''' file available from [http://www.zentus.com/sqlitejdbc/ www.zentus.com/sqlitejdbc].
 
</tanbox>
 
</tanbox>
 
<br />
 
<br />
Line 54: Line 54:
 
=Testing=
 
=Testing=
 
* That's it!
 
* That's it!
* Try and run the sketch and verify that you get an output, as illustrated below:<br /> <br /> <br />  
+
* Try and run the sketch and verify that you get an output, as illustrated below.
 +
* You may want to move on to [[Tutorial: SQLite and Processing, Part II| Tutorial 2]] to see how to run this in Eclipse.<br /> <br /> <br />  
 
<center>
 
<center>
 
[[Image:SQLite_example1.pde.png|600px]]
 
[[Image:SQLite_example1.pde.png|600px]]

Latest revision as of 16:21, 30 June 2011

--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.
Part 2 takes the same example and creates an Eclipse project with it.

Download

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.



Note that the sketch also works with the newer sqlitejdbc-v056.jar file available from www.zentus.com/sqlitejdbc.



Testing

  • 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.


SQLite example1.pde.png