//存储过程P_GET_ID(?,?),第一个为输入参数,第二个为输出参数 public static int createID()
{
int id=Math.abs((int)(new java.util.Date()).getTime());;
try {
Context ctx = new InitialContext();
javax.sql.DataSource ds = (javax.sql.DataSource)ctx.lookup("ticsDS");
Connection conn = ds.getConnection();
CallableStatement cs=conn.prepareCall("{call P_GET_ID(?,?)}");
cs.setString(1,"YHSCX_ZTB");
cs.registerOutParameter(2,java.sql.Types.INTEGER);
cs.execute();
id=cs.getInt(2);
} catch (Exception e) {
e.printStackTrace();
}
return id;
}
{
int id=Math.abs((int)(new java.util.Date()).getTime());;
try {
Context ctx = new InitialContext();
javax.sql.DataSource ds = (javax.sql.DataSource)ctx.lookup("ticsDS");
Connection conn = ds.getConnection();
CallableStatement cs=conn.prepareCall("{call P_GET_ID(?,?)}");
cs.setString(1,"YHSCX_ZTB");
cs.registerOutParameter(2,java.sql.Types.INTEGER);
cs.execute();
id=cs.getInt(2);
} catch (Exception e) {
e.printStackTrace();
}
return id;
}
String pro = "{call pro_rs_bmxx_update(?,?,?,?,?}";
cs = connection.prepareCall(pro,ResultSet.TYPE_SCROLL_INSENSITIVE
,ResultSet.CONCUR_UPDATABLE);
cs.setString(1,bm.getBmbh());
cs.setString(2,bm.getBmmc());
cs.setString(3,bm.getLxdh());
cs.setString(4,bm.getBmzg());
cs.setString(5,bm.getBz());
cs.executeUpdate();
有错吗?抛出的异常是找不到输入表或查询!