java认证辅导:java调用存贮过程Java认证考试
文章作者 100test 发表时间 2010:01:01 15:50:52
来源 100Test.Com百考试题网
public void testProc(){
Connection conn = getConnection().
CallableStatement stmt = null.
try{
stmt = conn.prepareCall("{call mappingProc(?)}").
stmt.registerOutParameter(1, Types.INTEGER).
stmt.execute().
int i= stmt.getInt(1).
System.out.println("count = " i).
}catch(Exception e){
System.out.println("hahad = " e.toString()).
}finally{
try {
stmt.close().
conn.close().
}catch (Exception ex) {
System.out.println("ex : " ex.getMessage()).
}
}
}
package yicha.cigan.ren.
import java.sql.CallableStatement.
import java.sql.Connection.
import java.sql.DriverManager.
import java.sql.Date.
import java.sql.PreparedStatement.
public class CallProdure {
/**
* @param args
* @throws ClassNotFoundException
*/