import de.bezier.mysql.*; // import the mysql library MySQL msql; // create a variable named msql that will hold a MySQL object void setup() { // if you don't know what this does, you're screwed size( 100, 100 ); // same for this line // -----------replace the three values below with your name----------------- msql = new MySQL( "mat259.mat.ucsb.edu", "charlie","charlie","charlie", this ); // this creates a new MySQL object. the parameters are: // 1: the server to log into // 2: the name of the database // 3: your user name // 4: your password // 5: the processing object it should link to if ( msql.connect() ){ // MySQL.connect() tries to connect to the MySQL server. If successful, it returns true // ------------replace YOURTABLENAME with... you guessed it, the name of your table----------- msql.query( "SELECT * FROM YOURTABLENAME" ); // Select everything from the table while (msql.next()){ // MySQL.next() selects the next row in the table for examination // By putting this in a while loop, we can loop through every row in the table and // have the loop automatically stop when there are no rows remaining String s = msql.getString("description"); // MySQL.getString() gets a string object from the indicated column, in this case "description" int n = msql.getInt("id"); // MySQL.getInt() gets an int from the indicated column, in this case "id" println(s + " :: " + n); // print the string found in description and it's id number } }else{ // if MySQL.connect() fails, we jump down here... // connection failed ! println("connection failed"); } } void draw(){}