索引中丢失 in 或 out 参数 1是什么错误
publicintinsert(MessageBeanmb){//MessageBeanmb=newMessageBean();Stringid=CreateId.get...
public int insert(MessageBean mb) {
//MessageBean mb=new MessageBean();
String id = CreateId.getStringId();
int i = 0;
String s1 = "insert into q_message values(?,?,?)";
try {
con = ConnectionDB.getConnectionDB();
sql = con.prepareStatement(s1);
System.out.println("fjhf");
rs = sql.executeQuery();
System.out.println("gsdf");
sql.setString(1, id);
sql.setString(2,mb.getMsend());
sql.setString(3, mb.getMcontent());
i = sql.executeUpdate();
con.close();
}
catch (Exception e) {
e.printStackTrace();
}
return i;
}
这是dao层 显示的是rs = sql.executeQuery();有错,
java.sql.SQLException: 索引中丢失 IN 或 OUT 参数:: 1
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:111)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:145)
at oracle.jdbc.driver.OraclePreparedStatement.processCompletedBindRow(OraclePreparedStatement.java:1680)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3279)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3328)
at dao.MessageDao.insert(MessageDao.java:36)
at action.MessageAction.insert(MessageAction.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source) 展开
//MessageBean mb=new MessageBean();
String id = CreateId.getStringId();
int i = 0;
String s1 = "insert into q_message values(?,?,?)";
try {
con = ConnectionDB.getConnectionDB();
sql = con.prepareStatement(s1);
System.out.println("fjhf");
rs = sql.executeQuery();
System.out.println("gsdf");
sql.setString(1, id);
sql.setString(2,mb.getMsend());
sql.setString(3, mb.getMcontent());
i = sql.executeUpdate();
con.close();
}
catch (Exception e) {
e.printStackTrace();
}
return i;
}
这是dao层 显示的是rs = sql.executeQuery();有错,
java.sql.SQLException: 索引中丢失 IN 或 OUT 参数:: 1
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:111)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:145)
at oracle.jdbc.driver.OraclePreparedStatement.processCompletedBindRow(OraclePreparedStatement.java:1680)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3279)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3328)
at dao.MessageDao.insert(MessageDao.java:36)
at action.MessageAction.insert(MessageAction.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source) 展开
若以下回答无法解决问题,邀请你更新回答
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询