public static void testFunc() throws Exception{
Class.forName("com.ibm.db2.jcc.DB2Driver");
Connection conn = DriverManager.getConnection("jdbc:db2://localhost:50000/cyx","db2admin","admin");
CallableStatement stmt=conn.prepareCall("{?=call GETSAL(?,?)}");
int condIndex = 1;
stmt.registerOutParameter(condIndex++, Types.INTEGER);
stmt.setInt(condIndex++, 9000);
stmt.setInt(condIndex++, 11);
try{
stmt.execute();
}catch(SQLException e){
System.out.println(e.getSQLState());
e.printStackTrace();
}
}
这样做应该是jdbc标准,为什么不行呢?
|