Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2003

    Unanswered: An sql error couldn't be caught and exit gracefully

    have a select statement embedded in java code. This select statement queries out a bunch of records and then does string concatenation on a certain field. And due to one record having more than 4000+ chars on that field, the query failed on this record after returning a few good records in sqlplus. The error is : "ORA-01489: result of string concatenation is too long".

    When integrated with JDBC, it turns out no exception was thrown out and the program was just stuck in there

    Here is a few line of code:

    1. try{
    2. ResultSet rs=statement.executeQuery(select);
    3. while(
    4. {
    5. //do something
    6. }
    7. }
    8. catch (Exception e)
    9. {
    10. //handle it.
    The program seems to hang at line 3 without exception thrown up when it gets the bad record. Anyone has any idea how to catch this type of error? thanks...

  2. #2
    Join Date
    Apr 2004
    you have to catch the SQLException and print out all related messages, states, and verndor generated error codes.
    here's some example code below:

    try {
    catch(SQLException e){
    while (e != null) {
    System.out.println("| Message: " + e.getMessage ());
    System.out.println("| SQLState: " + e.getSQLState ());
    System.out.println("| ErrorCode: " + e.getErrorCode ());
    e = e.getNextException();

Posting Permissions

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