j2ee中使用存储过程 用CallableStatement调用存储过程 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 CallableStatement cs; 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) { } spring注解切面不起作用 我是初初菜鸟 socket 求解题思路 求助!hibernate 多表连接查询(就两个表) 请问在tomcat中配置了一个datasource,请问在应用程序中能取得吗? spring事物管理 一道简单实用的java题,快来拿分 关于IBM WebSphere 环境下的Web Service 的教程 学J2EE应该从那里开始! 用js获得文本域中内容 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) {
}