[ 
http://issues.apache.org/jira/browse/DERBY-819?page=comments#action_12363013 ] 

Anurag Shekhar commented on DERBY-819:
--------------------------------------

SQLExceptionFactory checks for jvm version and if the jvm version is jvm16 or 
above 
it will instantiate JDBC40ExceptionFactory. As JDBC40ExceptiopnFactory have 
references of JDBC40 specific Exceptions it can't be loaded in jvm's prior to 
16. Thats why SQLExceptionFactory uses reflection to load and again uses 
reflection to call getJDBC40Exception which returns JDBC40Specific exceptions.

If the current JVM version is less that 16 it returns the EmbeddedSQLException 
same as the way Util class was returning.

If JVM version is 16 but JDBC40ExceptionFactory doesn't exist (will happen if 
while building derby there was no jdk1.6) it throws a SQLRuntime Exception 
indicating the derby.jar doesn't have this class. In case RuntimeException is 
also missing (can happen only if rt.jar is improper) throws a RuntimeException.

I will add above explanation in the code.


I will check InternalDriver to see if I can move SQLExceptionFactory methods 
into that but JDBC40ExceptionFactory will be required.

I will check the spec and api again to find if it provides any method to create 
JDBC40 Exception. If it does we won't need JDBC40ExceptionFactory.

Thanks for looking into the patch.



> Provide JDBC4 SQLException subclasses support in Embedded driver
> ----------------------------------------------------------------
>
>          Key: DERBY-819
>          URL: http://issues.apache.org/jira/browse/DERBY-819
>      Project: Derby
>         Type: Sub-task
>   Components: JDBC
>  Environment: all
>     Reporter: Anurag Shekhar
>     Assignee: Anurag Shekhar
>     Priority: Minor
>  Attachments: embedexception.diff, stat.out
>


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to