Results 1 to 3 of 3
  1. #1
    renu is offline Senior Member
    Join Date
    May 2010
    Posts
    117
    Rep Power
    0

    Question How to capture the error message returned from the procedure and printit out.

    Hi

    I am working on a project , where i will call a procedure passing some information to the procedures parameters.
    If the procedure doesnot receive the right parameter values ..it displays an error message .

    How to capture the error message and print it out to the screen .

    Java Code:
    CallableStatement proc_stmt;
    			try {
    				proc_stmt = connection.prepareCall("{? = call PKG_COMPARE.F_2_SCHOOL(?,?,?)}");	
    //				Register the type of the return value		
    				proc_stmt.registerOutParameter(1,OracleTypes.CURSOR);			   
    				proc_stmt.setInt(2,year);
    				proc_stmt.setString(3,schoolname);			                         proc_stmt.setString(4, version1);
    							
    //              Execute and retrieve the returned value
    				proc_stmt.execute();
    				ResultSet rs = (ResultSet) proc_stmt.getObject(1); // 
    ?????-----> WHAT CODE I NEED TO WRITE TO CAPTURE THE ERROR RETURNED FROM THE PROCEDURE ????

    Thanks in advance .

  2. #2
    Zack's Avatar
    Zack is offline Senior Member
    Join Date
    Jun 2010
    Location
    Destiny Islands
    Posts
    692
    Rep Power
    5

    Default

    Here's a basic bit on exceptions: Lesson: Exceptions (The Java™ Tutorials > Essential Classes)

    Here's how to get the error message: http://download.oracle.com/javase/6/...l#getMessage()
    ...and you will find other helpful links in that page also.

    Best of luck!

  3. #3
    renu is offline Senior Member
    Join Date
    May 2010
    Posts
    117
    Rep Power
    0

    Question

    thank all again ....
    Last edited by renu; 10-07-2010 at 09:44 PM. Reason: solved by myself

Similar Threads

  1. capture db connection timeout error
    By uthpalaw in forum JDBC
    Replies: 11
    Last Post: 09-09-2010, 11:45 AM
  2. Error Message ..
    By Hamodi18 in forum New To Java
    Replies: 15
    Last Post: 07-11-2010, 03:31 AM
  3. Replies: 0
    Last Post: 02-03-2010, 08:20 AM
  4. Error Message????
    By Cubba27 in forum New To Java
    Replies: 11
    Last Post: 11-21-2009, 02:46 PM
  5. Replies: 1
    Last Post: 10-26-2009, 04:38 PM

Posting Permissions

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