RE: JDBC and handling of errors
From: Yuan Shao (v-yshao_at_online.microsoft.com)
Date: 03/18/04
- Next message: ricky: "select 1/3 =0?????"
- Previous message: ricky: "Re: how to trim last 2 digits???"
- In reply to: Kalle Dahlberg: "RE: JDBC and handling of errors"
- Next in thread: Kalle Dahlberg: "RE: JDBC and handling of errors"
- Reply: Kalle Dahlberg: "RE: JDBC and handling of errors"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 18 Mar 2004 03:55:23 GMT
Hello,
After conforming with our developers, this is not a bug with jdbc driver.
The point at which the exception is returned is based on the point at which
the driver fetches the results. The JDBC ODBC Bridge and third party
driver that were tested must be fetching the results directly after
executing the procedure.
Take for example the following procedure:
Create procedure foo as
Select 1
Select 2
Select 1/0
You would need to use stmt.getMoreResults and stmt.getResultSet with our
driver in order to get to the result containing the exception. If the
driver returned the error directly after execution, then the two result
sets prior would not be available.
Code:
Statement stmt = conn.createStatement();
//stmt.execute("exec divByZero");
stmt.execute("exec foo");
System.out.println("Execute succeeded");
ResultSet rs;
rs = stmt.getResultSet();
System.out.println("getResultSet succeeded");
while(rs.next()){
System.out.println("rs.next succeeded");
if (stmt.getMoreResults())
{
rs = stmt.getResultSet();
}
}
Regards,
Michael Shao
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
- Next message: ricky: "select 1/3 =0?????"
- Previous message: ricky: "Re: how to trim last 2 digits???"
- In reply to: Kalle Dahlberg: "RE: JDBC and handling of errors"
- Next in thread: Kalle Dahlberg: "RE: JDBC and handling of errors"
- Reply: Kalle Dahlberg: "RE: JDBC and handling of errors"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|