Sure, it's below. Definitely not the greatest code in the world, but it is the exact same code that I'm using to test HSQL.

Thanks!!!

---------------------------------------------------------------------------------------------------------------------

import java.sql.*;

public class Cloudscape {

 Connection conn;

 public Cloudscape() throws Exception {
   Class.forName("com.ihost.cs.jdbc.CloudscapeDriver");
   conn = DriverManager.getConnection("jdbc:cloudscape:test;create=true");
 }

 public void shutdown() throws SQLException {
   conn.close();
 }

 public synchronized void query(String expression) throws SQLException {
   Statement st = null;
   ResultSet rs = null;

   st = conn.createStatement();
   rs = st.executeQuery(expression);

   st.close();
 }

 public synchronized void update(String expression) throws SQLException {
   Statement st = null;

   st = conn.createStatement();
   st.executeUpdate(expression);

   st.close();
 }

 public static void main(String[] args) {
   Cloudscape cloudscape = null;

   try {
     cloudscape = new Cloudscape();
   } catch (Exception e) {
     e.printStackTrace();

     return;
   }

try {
cloudscape.update("CREATE TABLE mytable(id int not null generated always as identity, col1 varchar(256) not null, col2 int not null)");
} catch (SQLException e) {
e.printStackTrace();
}


   long start = System.currentTimeMillis();

   for (int i = 0; i < 10000; i++) {
     try {
       cloudscape.update(
           "INSERT INTO mytable(col1, col2) VALUES('blah', 100)");
       cloudscape.update(
           "INSERT INTO mytable(col1, col2) VALUES('blah', 100)");
       cloudscape.update(
           "INSERT INTO mytable(col1, col2) VALUES('blah', 100)");
       cloudscape.update(
           "INSERT INTO mytable(col1, col2) VALUES('blah', 100)");

       cloudscape.query("SELECT * FROM mytable");

     } catch (SQLException e) {
       e.printStackTrace();
     }
   }

System.out.println("time: " + (System.currentTimeMillis() - start) / 1000);

   try {
     cloudscape.shutdown();
   } catch (SQLException e) {
     e.printStackTrace();
   }
 }
}

_________________________________________________________________
Don�t just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/




Reply via email to