//调用存储过程带参
CallableStatement ca = conn.prepareCall("{call Login (?,?)}");
ca.setString(1,username);
ca.setString(2,password);
ca.execute();
//调用存储过程带返回参数的
CallableStatement ca = conn.prepareCall("{call Login (?,?,?)}");
ca.setString(1,username);
ca.setString(2,password);
ca.registerOutParameter(3,java.sql.Types.INTEGER);
ca.execute();
int returnOut = ca.getInt(3);
//调用存储过程带返回值的return
CallableStatement ca = conn.prepareCall("{?=call Login (?,?,?)}");
ca.setString(2,username);
ca.setString(3,password);
ca.registerOutParameter(1,java.sql.Types.INTEGER);
ca.execute();
int returnOut = ca.getInt(1);
//调用存储过程返回两个结果集
CallableStatement ca = conn.prepareCall("{call Login (?,?,?)}");
ca.setString(1,username);
ca.setString(2,password);
ca.execute();
ResultSet rs = ca.getResultSet();
while(rs.next())
{
System.out.println(rs.getInt(1)+rs.getString(2));
}
if(ca.getMoreResults())
{
rs = ca.getResultSet();
while (rs.next()) {
System.out.println(rs.getInt(1) + rs.getString(2));
}