This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem in CallableStatement
 
Similar Threads
Read Excel values and store in to Database
sun.jdbc is not available
error in my struts application no getter methods
Data being retrieved even though MySQL driver is not loaded
about super key