import de.bezier.data.sql.*; MySQL msql; void setup() { size( 100, 100 ); // this example assumes that you are running the // mysql server locally (on "localhost"). // // replace --username--, --password-- with your mysql-account. // String user = "bob"; String pass = "password"; // name of the database to use // String database = "test"; // name of the table that will be created // String table = "newtable"; // connect to database of server "localhost" // msql = new MySQL( this, "localhost", database, user, pass ); if ( msql.connect() ) { // create a table with an id and a word // msql.execute( "CREATE TABLE IF NOT EXISTS " + table + " ("+ "id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,"+ "word VARCHAR( 255 )"+ ")" ); // fill the table with some data // msql.execute( "INSERT INTO " + table + " (word) VALUES (\"Lorem\")" ); msql.execute( "INSERT INTO " + table + " (word) VALUES (\"ipsum\")" ); msql.execute( "INSERT INTO " + table + " (word) VALUES (\"dolor\")" ); // now read it back out // msql.query( "SELECT * FROM " + table ); while (msql.next()) { String s = msql.getString("word"); int n = msql.getInt("id"); println(s + " " + n); } // need to find out how many rows there are in table? // msql.query( "SELECT COUNT(*) FROM " + table ); msql.next(); println( "number of rows: " + msql.getInt(1) ); } else { // connection failed ! println("connection failed!"); } } void draw() { // ... }