Would it be acceptable for there to continue to be a static method in
Util that worked as it does today, always returning a
java.sql.SQLException? This method would have sanity checks to ensure
that the SQLState passed in did not start wiht any of the special values
that require specific sub-classes of SQLException. Then cases like
EmbedResultSetMetaData could use that method as the exeception it raises
does not have one of the special SQL states.


I have looked into the code base there are several places where SQLException is instantiated directly but there out of these only two has SQLStatus (ConnectionUtil.getCurrentLCC and JNDIAuthenticationSchemeBase.getLoginSQLException)

Another way to solve this problem can be to set a separate exception factory instance in InternalDriver class. If we have this in the beginning of boot method of InternalDriver. This instance can be static and once set need not be removed. Driver implementation can provide this factory object by a method which can be overridden by the sub class of InternalDriver. If the driver is booted after stopping boot method can skip setting the factory instance as the Driver loaded will always be latest version available for the jvm.

By doing this we don't have to worry about having the factory instance being null and there will be uniform way of creating exception across the code base.

anurag

anurag

Reply via email to