oracle - Exception in thread "main" java.sql.SQLException: Missing defines -
have done below sample jdbc program retrieving user details.now getting surprised same callable statement getting different result set same output parameter index.ideally should return same resultset object.
- when got resultset moving cursor -1 0.
- i retrieving data resultset same output param using column name getting following exception
,
exception in thread "main" java.sql.sqlexception: missing defines
system.out.println("before loading connection"); drivermanager.registerdriver(new oracle.jdbc.oracledriver()); connection connection = drivermanager.getconnection( "jdbc:oracle:thin:@170.45.3.165:1541/testdb.mycomp.com", "admin", "admin123"); system.out.println("connection loaded " + connection); callablestatement callprocedure = connection .preparecall("{call admin_user.fetch_user_details(?,?)}"); callprocedure.setstring(1, "userid=testid"); callprocedure.registeroutparameter(2, oracle.jdbc.oracletypes.cursor); callprocedure.execute(); resultset resultuserdetails = (resultset) callprocedure.getobject(2); resultuserdetails.next(); resultset resultuserdetails1 = (resultset) callprocedure.getobject(2); string username = resultuserdetails1.getstring(col_name_user_name); system.out.println(resultuserdetails); system.out.println(resultuserdetails1); system.out.println(resultuserdetails == resultuserdetails1);
can has idea why getting 2 different resultset same output index callable statement?
according callablesatement api expression should this
{call <procedure-name>[(<arg1>,<arg2>, ...)]}
try
callablestatement callprocedure = connection.preparecall("{call admin_user.fetch_user_details(?,?)}");
Comments
Post a Comment