用dbutils对oracle模糊查询出现ORA-00904问题

笨笨咸鱼 发布于 2017/03/23 09:36
阅读 305
收藏 0

 代码如下:

QueryRunner queryRunner = new QueryRunner();
connection = JdbcUtils.getConnection();
String sql = "SELECT id,name,address,phone FROM customer WHERE name LIKE ?";
List<Customer> list = queryRunner.query(connection, sql,new BeanListHandler<Customer>(Customer.class), "%j%");
for(Customer c: list){
System.out.println(c);

我的sql用自己编的DAO代码进行模糊查询没有问题,但用queryRunner就出现如下错误:

java.sql.SQLException: ORA-00904: "NAMEIKE": 标识符无效
Query: SELECT id,name,address,phone FROM customer WHERE name LIKE ? Parameters: [%j%]
	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:212)
	at com.lteagle.mvcapp.test.Test.main(Test.java:19)

为什么出现“NAMEIKE”这个无效标识符呢?

加载中
返回顶部
顶部