import javax.sql.rowset.CachedRowSet;
import com.sun.rowset.CachedRowSetImpl;
/*
................
...........
.....
*/
Connection con = null;
java.sql.Statement st = null;
java.sql.ResultSet rs = null;
try {
// 通过JNDI获得数据库连接
String driverClass = this.getServlet().getServletConfig()
.getInitParameter("driverClass");
String jdbcUrl = this.getServlet().getServletConfig()
.getInitParameter("jdbcUrl");
String user = this.getServlet().getServletConfig()
.getInitParameter("user");
String password = this.getServlet().getServletConfig()
.getInitParameter("password");
con = DriverManager.getConnection(jdbcUrl, user, password);
CallableStatement cstmt= null;;
sql = "{? = call pkg_money_check.get_factor_CUR(?,?,?,?,?,?)}";
cstmt = con.prepareCall(sql);
cstmt.registerOutParameter(1,oracle.jdbc.OracleTypes.CURSOR);
cstmt.setString(2,MONTH_ID);
cstmt.setString(3,AGENT_AREA);
cstmt.setString(4,ruleId);
cstmt.setString(5,userInfo.getUserID());
cstmt.setString(6,sessionID);
cstmt.setString(7,IP);
cstmt.execute();
System.out
.println("call pkg_money_check.get_factor_CUR('"
+ MONTH_ID
+ "','"
+ AGENT_AREA
+ "','"
+ ruleId
+ "','"
+ userInfo.getUserID()
+ "','"
+ sessionID
+ "','"
+ IP
+ "')");
rs = (ResultSet) cstmt.getObject(1);
CachedRowSet crs = new CachedRowSetImpl();
crs.populate(rs);
ds = dc.convertRsToDs(crs);
} catch (Exception e) {
e.printStackTrace();
} finally {
con.commit();
if (rs != null) {
rs.close();
rs = null;
}
if (st != null) {
st.close();
st = null;
}
}