DriverManager.isDriverAllowed has an unintentional side-effect?

Jaikiran Pai jai.forums2013 at
Tue Feb 11 03:05:20 UTC 2020

Hello Lance,

On 11/02/20 2:05 am, Lance Andersen wrote:
> Hi Jaikiran
>> Should this check in the isDriverAllowed, instead use "false" and not
>> trigger the intialization of the class?
> As I mentioned above, this dates back to the very early days of JDBC
> and JDK 1.2.  Any changes in this area could be quite disruptive and
> would require extensive testing. 
That's a valid reason and I understand the unwillingness to change this.

On a related note, the ensureDriversInitialized method right now gets
run once per JVM. However, given that the rest of the DriverManager
deals with per classloader Driver(s), would it be right to somehow make
ensureDriversInitialized run once per classloader instance? That way,
this issue won't show up in first place, given that
ensureDriversInitialized would have ensured that any drivers available
in that classloader would have been loaded during the first call from
class A (in that example).


More information about the core-libs-dev mailing list