用CallableStatement调用存储过程
解决方案 »
- 关于FileInputStream错误的问题,请各位大侠帮忙
- jira!求助!求助!
- JBoss:javax.naming.NameNotFoundException: AccountBean not bound
- 大家J2EE这条路是怎么走过来的?有什么经验教训?
- 如何实现java中定时实现某种方法?
- dom中如何将一个xml字符串加入到已有的Document中
- sax解析中怎么获得element的schema类型?
- 这个返回系统绝对根路径的方法谁跟我详细讲下
- win7 ie8 正常请求应用几次后,再次请求会出现一直处于正在加载的状态,过一会儿浏览器显示无法连接
- 最近在学servlet,请问哪有视频的教程可以下
- struts 问题
- 9月23日成都WS-Security演讲及其代码下载
try {
// Call a procedure with no parameters
cs = connection.prepareCall("{call myproc}");
cs.execute();
// Call a procedure with one IN parameter
cs = connection.prepareCall("{call myprocin(?)}");
// Set the value for the IN parameter
cs.setString(1, "a string");
// Execute the stored procedure
cs.execute();
// Call a procedure with one OUT parameter
cs = connection.prepareCall("{call myprocout(?)}");
// Register the type of the OUT parameter
cs.registerOutParameter(1, Types.VARCHAR);
// Execute the stored procedure and retrieve the OUT value
cs.execute();
String outParam = cs.getString(1); // OUT parameter
// Call a procedure with one IN/OUT parameter
cs = connection.prepareCall("{call myprocinout(?)}");
// Register the type of the IN/OUT parameter
cs.registerOutParameter(1, Types.VARCHAR);
// Set the value for the IN/OUT parameter
cs.setString(1, "a string");
// Execute the stored procedure and retrieve the IN/OUT value
cs.execute();
outParam = cs.getString(1); // OUT parameter
} catch (SQLException e) {
}