// simple Database access for squirrels

// using PreparedStatement to insert a record
PreparedStatement stmt = conn.prepareStatement( "INSERT INTO nutcaches VALUES (?,?,?)" );
stmt.setString( 1, "butternuts" /* type */);
stmt.setInt( 2, 40 /* count of nuts */ );
stmt.setBoolean( 3, true /* flawless nut */ );
stmt.executeUpdate();

// using PreparedStatement to do a query
PreparedStatement fetch = conn.prepareStatement( "SELECT * FROM nutcaches WHERE nutcount > ?" );
fetch.setInt( 1, 12 /* nuts wanted */ );
ResultSet r = fetch.executeQuery();
while ( r.next() )
   {
   String nutType = r.getString( 1 );
   int nutCount = r.getInt( 2 );
   boolean quality = r.getBoolean( 3 );
   } // end while