Advertisement
kusha45

Calling Stored Procedures

Sep 26th, 2011
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.63 KB | None | 0 0
  1.     CallableStatement cst = con.prepareCall("{call SP_NewMsgCounter(?,?,?)}");
  2.            
  3.             Calendar cal = Calendar.getInstance();
  4.             SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss.SSS");
  5.             String date = sdf.format(cal.getTime());
  6.             cst.setInt(1,userId);
  7.             cst.setLong(2,taskId);
  8.             cst.setString(3, date);
  9.  
  10.             rs = cst.executeQuery();
  11.            
  12.             while(rs.next()){
  13.                 int userId1 = rs.getInt(1);
  14.                 long taskid1 = rs.getLong(2);
  15.                 String dat = rs.getString(3);
  16.                 System.out.println("The UserId Is :"+userId1);
  17.                 System.out.println("The TaskId Is :"+taskid1);
  18.                 System.out.println("The Server Is :"+dat);
  19.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement