Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

jdbc issue

 
Laye Chow
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used the jdbc thin driver to access a function on oracle 9.2.0.4 via Callablestatement, contained 9 parameters.
statement = "begin " + "? := kiva_inspection.get_permit_insp_date(?,?,?,?,?,?,?,?); " +
"end;";
cs = con.prepareCall(statement);

cs.registerOutParameter(1, Types.DATE);

cs.setDate(2,
(scheduledDate == null) ? null : new java.sql.Date(scheduledDate.getTime()));

cs.setString(3, inspm.getInspectionType());
cs.setString(4, inspector);
cs.setLong(5, capID.getPidRsProblemId());
cs.setString(6, null);
cs.setString(7, null);
cs.setInt(8, inspm.getWorkLoad());
cs.setString(9, Resources.NEED_VALIDATE_DATE);

cs.registerOutParameter(4, Types.CHAR);
cs.registerOutParameter(8, Types.NUMERIC);

cs.executeUpdate();

availableDate = cs.getDate(1);

inspector = cs.getString(4);
I run the code above and no exceptions thrown, but the result is wrong.I run this function with the same parameters, it works fine.
So, What's wrong with my code? Any idea appricated.
Thanks,
Samuel
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
did you validate the inputs while you are executing procedure from java code.
There might be a possiblity that your inputs differ

Shailesh
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!