• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in CallableStatement

 
Smita Tyagi
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For the following code---------
import java.sql.*;
public class MyDBTest
{
Connection myConn = null;
MyDBTest()
{
try {
Class.forName("sun.jbc.odbc.JdbcOdbcDriver");
myConn = DriverManager.getConnection("jdbc dbc:CatalogSalesSystem","sa","");
}
catch(ClassNotFoundException exp){}
catch(SQLException exp){}
}
public void processMe(int i, String str, float sal){
try{
System.out.println("*");
CallableStatement callStat = myConn.prepareCall(" {call myProcedure(?,?,?)}");
System.out.println("*);
callStat.setInt(1 , i);
callStat.setString(2 , str);
callStat.setFloat(3 , sal);
int in = callStat.executeUpdate();
}
catch(SQLException exp){
System.out.println(exp);
}
}
public static void main(String[] args)
{
MyDBTest myDB = new MyDBTest();
myDB.processMe(22,"Soni",2000);
}
}
CREATE PROCEDURE myProcedure @empId int, @empName varchar(20), @empSal float AS
begin transaction
insert into tabCheck(EmpId,EmpName,EmpSalary) VALUES (@empID,@empName,@empSal)
commit

return
I am geting
*
java.lang.NullPointerException
Would anybody help me in finding the problem???
Thanks in advance
 
Smita Tyagi
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everybody,
Don't waste your time I have found the solution it was typo mistake on my part.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic