RE: JDBC and handling of errors

From: Yuan Shao (v-yshao_at_online.microsoft.com)
Date: 03/18/04


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.



Relevant Pages

  • Re: windows error codes
    ... Driver Development Tools: Windows DDK ... This indicates that a kernel-mode program generated an exception which the error handler did not catch. ... For a complete list of exception codes, see the ntstatus.h file located in the inc directory of the Windows DDK. ... This article describes how to troubleshoot a "STOP 0x0000001E KMODE_EXCEPTION_NOT_HANDLED" error message. ...
    (microsoft.public.windowsxp.general)
  • RE: getting Kmode Exception Not Handled error
    ... The address at which the exception occurred 0xf7163ab0 ... Faulty device driver or system service. ... Disabling memory caching of the BIOS might also resolve the error. ...
    (microsoft.public.win2000.setup)
  • Re: BSOD
    ... This indicates that a kernel-mode program generated an exception which the ... the inc directory of the Windows Driver Kit. ... Make sure you have enough disk space. ... with your hardware vendor for any BIOS updates. ...
    (microsoft.public.windows.server.general)
  • CreateThread() throws duplicate TLB exception on MIPS (CE5)
    ... I have a driver that spawns a thread when in active power state (D0- ... After executing a system suspend and subsequent resume, ... the MIPS and RMI manuals say of this exception: ...
    (microsoft.public.windowsce.platbuilder)
  • Exception executing simple statement
    ... Executing next statement results in Exception below: ... PreparedStatement ps1 = ... [SQLServer 2000 Driver for JDBC]Unhandled ...
    (comp.lang.java.databases)