======================================================
注:本文源代码点此下载
======================================================
java.sql.sqlexception: 索引中丢失 in 或 out 参数::
像这样的错误我想大家可能是长有的错误希望大家都能掌握
这样的错误是由于我们在开发时不小心出的错
java.sql.sqlexception: 索引中丢失 in 或 out 参数:: 2
at oracle.jdbc.driver.databaseerror.throwsqlexception(databaseerror.java:112)
at oracle.jdbc.driver.databaseerror.throwsqlexception(databaseerror.java:146)
at oracle.jdbc.driver.oraclepreparedstatement.processcompletedbindrow(oraclepreparedstatement.java:1681)
at oracle.jdbc.driver.oraclepreparedstatement.executeinternal(oraclepreparedstatement.java:3280)
at oracle.jdbc.driver.oraclepreparedstatement.executequery(oraclepreparedstatement.java:3329)
at com.spring.services.userbusiness.loginaction(userbusiness.java:58)
at com.spring.services.userbusiness.main(userbusiness.java:27)
这个错误有很多人在发送语句时出的错.如:
有的sql语句可能全角与半角出现的:java.sql.sqlexception无效的列索引,
stringbuilder sql = new stringbuilder()
.append("select * from emp where uname=? and upass=? and state=? and a=?");
参数据过多等
而我今天在开发一个struts项目时出的是oracle的一个错误如下:
stringbuilder sql = new stringbuilder()
.append("select * from emp where uname=? and upass=?");
//2.preparedstatement对象指令
ps = conn.preparestatement(sql.tostring());
//3.设置参数
ps.setobject(1, dto.get("uname").tostring());
ps.setobject(1, dto.get("upass").tostring());
//4.执行判断
rs = ps.executequery();
这是由于一不小心就出错的这里只是设置参数的时候参数位置出了错
像这样的错误如果我们知道的话就可以在一堆代码中很快就能找到对吧
绿色通道:好文要顶关注我收藏该文与我联系