Hi,All

public void initialization() throws Exception {
        String strSeq = "create sequence testSeq;";
        String strSql = "create table t_test (id INTEGER not null,name
VARCHAR(10) not null);";
        Connection con = newConnection(); //"jdbc:h2:mem:test", "sa", ""
        if (null == con) {
                throw new Exception("Connection Error");
        }
        PreparedStatement ps = con.prepareStatement(strSeq);
        ps.addBatch(strSql);
        ps.executeBatch();
        closeStatement(ps);
        closeConnection(con);
}

After running out as follows abnormal:

Exception in thread "main" org.h2.jdbc.JdbcSQLException: This method
is not allowed for a prepared statement; use a regular statement
instead. [90130-63]
        at org.h2.message.Message.getSQLException(Message.java:89)
        at org.h2.message.Message.getSQLException(Message.java:93)
        at org.h2.message.Message.getSQLException(Message.java:71)
        at org.h2.message.Message.getSQLException(Message.java:114)
        at
org.h2.jdbc.JdbcPreparedStatement.addBatch(JdbcPreparedStatement.java:
214)
        at cn.tqb.db.h2.CreateScheam.initialization(CreateScheam.java:18)
        at cn.tqb.db.h2.CreateScheam.main(CreateScheam.java:25)

H2 Version: 1.0.79 (2008-09-26)

the strSeq and strSql merge together, there is no problem
String strCommand="create sequence testSeq;create table t_test (id
INTEGER not null,name VARCHAR(10) not null);";

Why?
Is H2 does not support it?




--~--~---------~--~----~------------~-------~--~----~
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