今天在项目测试中出现这个异常,究其原因是
rs = pstam.executeQuery("select count(*) counts from EF_FLOWPACKAGE_REWARD");
pstam是一个preparedStatement,不能这么用。因为它要求要绑定变量。
在oracle jdbc中,得定义一个新的statement
Statement stmt = conn.createStatement();
rs = stmt.executeQuery("select count(*) counts from EF_FLOWPACKAGE_REWARD");
本文探讨了在Oracle JDBC中使用PreparedStatement时遇到的问题及解决方案,重点解释了为什么直接使用预编译语句进行查询可能导致错误,并提供了正确的使用方法。
524

被折叠的 条评论
为什么被折叠?



