Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/308.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 要执行的SQL语句不能为空或null_Java_Oracle12c - Fatal编程技术网

Java 要执行的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

请告诉我错误在哪里!!要执行的SQL语句不能为空或null。。 我正处于进退两难的境地……请帮帮我

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)