Wednesday 15 May 2013

Calling SQL server 2008 Stored Procedure from Java -


I have created the following stored procedure in SQL Server 2008

  Calculate the processinfected @ Concerned Int'l Out AS @infected = COUNT (*) Choose from userInfo where user id is not (select user id with deleted infoines);   

Follow my Java code as is

  infected with callbelt = con.prepareCall ("exec countInfected ()"); Infected.registerOutParameter (1, java.sql.Types.INTEGER); Infected.execute (); System.out.println ("infected" + infected.getINT (1));   

but it generates the following error

java.lang.NullPointerException on core.dtable.Dbase.stored (Dbase.java:51)

Please guide me where I am wrong

  try {Conn = DBC connection. SQLDB Conn.setAutoCommit (wrong); Callable Stattement CS = Faucet; Cs = conn.prepareCall ("call {dbo.xxCount (?)}"); Cs.registerOutParameter (1, java.sql.Types.INTEGER); Cs.execute (); System.out.println ("INFECTED" + cs.getInt (1)); } Hold (exception mistake) {  

Put the parameter in your stored proc in your phone

No comments:

Post a Comment