DbUtils1.6+Druid1.0.20绑定变量查询oracle时报java.sql.SQLException: ORA-00942: 表或视图不存在
@wenshao 你好,想跟你请教个问题:DbUtils1.6+Druid1.0.20绑定变量查询oracle时报java.sql.SQLException: ORA-00942: 表或视图不存在
部分代码如下
String sql = "select * from user_tables where status=? and pct_free>=? and rownum<10";
sql="select * from nm_dm_obj_def t where prvcode=? and os_db_type=? and oper_time>to_date(?,'yyyymm')";
//List<Map<String, String>> result = db.queryForMapStrList(sql, new Object[]{"VALID",10});
List<Map<String, String>> result = db.queryForMapStrList(sql, new Object[]{"100","aix","201501"});
for (Map map : result) { System.out.println(map);
}
nm_dm_obj_def是业务表,user_tables是oracle系统表
使用绑定变量查询user_tables时是正常的。查询业务表时报如下错误:
java.sql.SQLException: ORA-00942: 表或视图不存在
Query: select * from nmcuser.nm_dm_obj_def t where prvcode=? and os_db_type=? and oper_time>to_date(?,'yyyymm') Parameters: [100, aix, 201501]
at org.apache.commons.dbutils.AbstractQueryRunner.rethrow(AbstractQueryRunner.java:392)
at org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:351)
at org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:289)
at com.asiainfo.util.DBBase.queryForMapStrList(DBBase.java:367)
at com.asiainfo.main.dbTest.main(dbTest.java:19)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Exception in thread "main" java.lang.NullPointerException
at com.asiainfo.main.dbTest.main(dbTest.java:20)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题已经解决,是oracle jdbc驱动包的问题