> 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();
}