I am failing at doing some basic JDBC which happens to be with h2.  I
am using h2-1.2.138.jar

Basic Junit test, it is basically something as challenging as a hello
world program except in this case its JDBC

    Connection conn = DriverManager.getConnection("jdbc:h2:mem:");

    Statement statement = null;
    statement = conn.createStatement();

    statement.execute("CREATE TABLE sample_table (sample_table_id
INTEGER, x_cord INTEGER, y_cord INTEGER);\n");
    System.out.println("Table update count:" +
statement.getUpdateCount());
    statement.close();
    statement = conn.createStatement();
    statement.execute("INSERT INTO sample_table (sample_table_id,
x_cord, y_cord) VALUES (0, 0, 0);\n");
    System.out.println("Insert update count:" +
statement.getUpdateCount());
    statement.close();
    statement = conn.createStatement();
    statement.execute("SELECT * from sample_table;\n");
    System.out.println("Select update count:" +
statement.getUpdateCount());
    System.out.println("Select more results:" +
statement.getMoreResults());
    System.out.println("Select results:" + statement.getResultSet());
    statement.close();
    conn.close();


The output is:
Table update count:0
Insert update count:1
Select update count:-1
Select more results:false
Select results:null

I was trying to read the results of my select statement.  But h2 is
telling me there are none.  Obviously I am doing something wrong I
just don't know what.

Mike Power

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to