wood burning stoves 2.0*
The moose likes JDBC and the fly likes Problem in CallableStatement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Problem in CallableStatement" Watch "Problem in CallableStatement" New topic
Author

Problem in CallableStatement

Smita Tyagi
Greenhorn

Joined: May 09, 2001
Posts: 21
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

Joined: May 09, 2001
Posts: 21
Hi Everybody,
Don't waste your time I have found the solution it was typo mistake on my part.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in CallableStatement