Results 1 to 3 of 3
  1. #1
    vsgovr is offline Member
    Join Date
    Oct 2010
    Posts
    1
    Rep Power
    0

    Default Prepared Statement exception is caught only in finally in Oracle app oc4j server

    For the below code,

    PreparedStatement ps = null;
    .....
    .....
    ps = conn.prepareStmt(......);
    .....
    .....
    1.try {
    2. ps.execute();
    3. } catch (Exception e) {
    4. throw new UserException(e);
    5. } finally {
    6. try {
    7. if (ps != null) {
    8. ps.close();
    9. }
    10. } catch (SQLException sqle) {
    11. System.out.println(sqle);
    12. }
    13. }
    14. }
    when an SQL exception "ORA-01401: inserted value too large for column" occurs line 2. ps.execute(); , the exception is not caugh at line 3 , but caught in line 10 ie. catch block in finally after the ps.close() .. why is this happening? Is there any setting in Oracle oc4j app server for exception being caught after ps.close()?

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Run it through a debugger and see what happens.

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,002
    Rep Power
    20

    Default

    Does your stack trace tell you which line the exception was thrown from?

Similar Threads

  1. JDBC Prepared Statement
    By Floetic in forum JDBC
    Replies: 4
    Last Post: 05-20-2009, 11:53 PM
  2. setup oc4j server in eclipse 3.3
    By mamri in forum Eclipse
    Replies: 0
    Last Post: 12-22-2008, 11:33 PM
  3. Prblem in Prepared Statement
    By haneeshrawther in forum JDBC
    Replies: 2
    Last Post: 04-25-2008, 09:49 AM
  4. Using Prepared Statement
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-06-2008, 09:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •