Java 要执行的SQL语句不能为空或null
请告诉我错误在哪里!!要执行的SQL语句不能为空或null。。 我正处于进退两难的境地……请帮帮我Java 要执行的SQL语句不能为空或null,java,oracle12c,Java,Oracle12c,请告诉我错误在哪里!!要执行的SQL语句不能为空或null。。 我正处于进退两难的境地……请帮帮我 public boolean commitDatabase(Connection con) throws Exception{ try{ con.commit(); con.setAutoCommit(true); String sqlstmt1 = super.getSql("enable_privUserT
public boolean commitDatabase(Connection con) throws Exception{
try{
con.commit();
con.setAutoCommit(true);
String sqlstmt1 = super.getSql("enable_privUserTrigger");
pstmt = con.prepareStatement(sqlstmt1);
pstmt.executeUpdate();
String sqlstmt2 = super.getSql("update_Status");
pstmt = con.prepareStatement(sqlstmt2);
pstmt.setString(1, "GREEN");
pstmt.executeUpdate();
}catch (SQLException e) {
System.out.println("commitDatabase : "+e.getMessage());
con.rollback();
con.setAutoCommit(true);
throw e;
}finally{
if(pstmt!=null) pstmt.close();
}
return true;
}
或
返回null代码>这就是错误
请提供更多信息
或
返回null代码>这就是错误
请提供更多信息
是否已正确初始化PreparedStatement对象?我认为你需要做一些事情,比如:
super.getSql("update_Status");
是否已正确初始化PreparedStatement对象?我认为你需要做一些事情,比如:
super.getSql("update_Status");
将您试图执行的实际SQL打印到控制台。其中一个可能是空的
像这样添加System.out.println(),并查看sqlstmt1和sqlstmt2的值:
PreparedStatement pstmt = con.prepareStament(sqlstmt1)
将您试图执行的实际SQL打印到控制台。其中一个可能是空的
像这样添加System.out.println(),并查看sqlstmt1和sqlstmt2的值:
PreparedStatement pstmt = con.prepareStament(sqlstmt1)