Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Callable statement giving Null Pointer Exception

635127Nov 29 2006 — edited Nov 29 2006
My below code where I'm calling a stored procedure is giving a null pointer exception. On the command prompt, the same arguments work and the record is added in db but not when I call the stored procedure from inside java program

CallableStatement insertStat = db_conn.prepareCall("{call InsertCourses(?,?,?,?,?,?,?,?)}");
insertStat.setString(1, course_type.trim());
insertStat.setInt(2,Integer.valueOf(str_course_number).intValue());
insertStat.setInt(3, course_section);
insertStat.setInt(4, course_units);
insertStat.setInt(5, Integer.valueOf(course_loc.room).intValue());
insertStat.setString(6,course_loc.building);
insertStat.setString(7, course_loc.hours);
insertStat.registerOutParameter(8,checkInsert);
insertStat.execute();
checkInsert = insertStat.getInt(8);

Here is the command that works fine from inside SQL editor

call university.InsertCourses('cmpe' , 500 , 1 , 3 , 700 , 'engr' , 'MT 0400-0500' , @a);

Debugged the code to make sure that all the above variables correspond to the values above.

Any ideas what is wrong???

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 27 2006
Added on Nov 29 2006
6 comments
872 views