-1

I have written a calling procedure but an exception is being thrown, please can you look at my code:

try 
{   
    connection myconn = Database.Get_Connection();
    CallableStatement mystmt =null;
    mystmt = myconn.prepareCall("{? =call proc_hi_check_user(?,?)}");
    mystmt.setString(1,name);
    mystmt.setString(2,"");
    mystmt.execute();
    param1 = mystmt.getInt(1);
    ResultSet myrs = mystmt.getResultSet();
    while(myrs.next())
    {
        System.out.println("inside");
        System.out.println(myrs.getInt(1));
        //result=myrs.getString(1);
    }
} catch (Exception e)
{
    System.out.println("db connection not connected");
}
NRKirby
  • 1,584
  • 4
  • 21
  • 38
Pandu Koturu
  • 25
  • 1
  • 1
  • 4

2 Answers2

0

From what you say in your comments, you seems to be missing a sql function "proc_pandu_check_user".

Check the body of the "proc_hi_check_user", somewhere there it should call this proc_pandu_check_user and it is probably missing or has wrong argument list.

cnom
  • 3,071
  • 4
  • 30
  • 60
0

Try executing below code:

try 
{   
    connection myconn = Database.Get_Connection();
    CallableStatement mystmt =null;
    mystmt = myconn.prepareCall("{? =call proc_hi_check_user(?,?)}");
    mystmt.registerOutParameter(1, java.sql.Types.OTHER);
    mystmt.setString(2,name);
    mystmt.setString(3,"");
    mystmt.execute();
    param1 = mystmt.getInt(1);
    ResultSet myrs = mystmt.getResultSet();
    while(myrs.next())
    {
        System.out.println("inside");
        System.out.println(myrs.getInt(1));
        //result=myrs.getString(1);
    }
} catch (Exception e)
{
    System.out.println("db connection not connected");
}
kk.
  • 3,747
  • 12
  • 36
  • 67