Hi,

> PreparedStatement ps = con.prepareStatement(strSeq);
> ps.addBatch(strSql);
> ps.executeBatch();

As the exception says, PreparedStatement.addBatch(String sql) is not
allowed. What is allowed is: Statement.addBatch(String sql). This is
defined by the JDBC specification. It is not a problem of H2. See
below how to fix your application.

> Exception in thread "main" org.h2.jdbc.JdbcSQLException: This method
> is not allowed for a prepared statement; use a regular statement
> instead. [90130-63]

You are using version 1.0.63, not 1.0.79 as you wrote. The error code
includes the version (xx-63 means version 1.0.63). Probably an old
h2.jar is in the classpath.

Regards,
Thomas

    public static void main(String[] a) throws Exception {
       String strSeq = "create sequence testSeq;";
       String strSql = "create table t_test (id INTEGER not null,name
VARCHAR(10) not null);";
       org.h2.Driver.load();
       Connection conn =
DriverManager.getConnection("jdbc:h2:mem:test", "sa", "");
       Statement stat = conn.createStatement();
       stat.addBatch(strSeq);
       stat.addBatch(strSql);
       stat.executeBatch();
       stat.close();
       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
-~----------~----~----~----~------~----~------~--~---

Reply via email to