Ok, I checked all my versions everywhere to see if I had the right
ones before posting this (unlike the previous time)
My H2 server is running 1.3.151, and the jar for the JDBC driver is
the same.
Now my problem is that when I call a stored procedure that "does not"
return a resultset I'm getting one. According to the docs:
The execute method returns a boolean to indicate the form of the first
result. You must call either the method getResultSet or getUpdateCount
to retrieve the result; you must call getMoreResults to move to any
subsequent result(s).
This is the function I'm using to test it.
public static void test() throws SQLException{
boolean retCode;
try{
Class.forName("org.h2.Driver");
}catch (ClassNotFoundException e){
e.printStackTrace();
}
ResultSet rs;
ResultSetMetaData rsmd;
Connection conn = DriverManager.getConnection("jdbc:h2:~/temp/test");
System.out.println("version: " +
conn.getMetaData().getDatabaseProductVersion());
//
conn.createStatement().execute("drop alias test_procedure");
conn.createStatement().execute(
"create alias test_procedure as $$" +
"void return_nothing(Connection c, String x) throws
SQLException { }$$");
CallableStatement c = conn.prepareCall("{call
msim_getDictionary(?)}");
c.setString(1, "Hello");
retCode=c.execute();
System.out.println("execute returns "+retCode); // returns true
should be false
rs = c.getResultSet(); // this should give an exception
rsmd=rs.getMetaData(); // so should this
for(int i=0;i<rsmd.getColumnCount();i++){
System.out.println(String.valueOf(i+1)+"."+rsmd.getColumnName(i+1));
}
System.out.println("isBeforeFirst: " + rs.isBeforeFirst());
rs.next();
System.out.println(rs.getInt(1));
conn.close();
}
--
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.