尝试插入openfire db中的表:
..
..
Connection con = new Connection();
Statment stmt = null;
try{
stmt.executeUpdate("insert into utable values ('a','a');");
}
catch(Exception e){
e.printStackTrace();
}
...
..
我收到以下错误:
java.sql.SQLSyntaxErrorException: ORA-00933: SQL command not properly ended
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:450)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:399)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1017)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:655)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:249)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:566)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:202)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:45)
at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:933)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1075)
at oracle.jdbc.driver.OracleStatement.executeUpdateInternal(OracleStatement.java:1640)
at oracle.jdbc.driver.OracleStatement.executeUpdate(OracleStatement.java:1603)
at oracle.jdbc.driver.OracleStatementWrapper.executeUpdate(OracleStatementWrapper.java:308)
at com.jolbox.bonecp.StatementHandle.executeUpdate(StatementHandle.java:497)
我尝试使用该查询手动插入db,我可以成功插入。我正在使用BoneCP连接池。从dbs读取我没问题。
答案 0 :(得分:2)
stmt.executeUpdate("insert into utable values ('a','a');") // ';' is wrong
使用,
stmt.executeUpdate("insert into utable values ('a','a')")