Comment 2 for bug 876476

Revision history for this message
Thomas Becker (tbecker) wrote :

Hi Wallace,

thanks for the quick reply. :) You could for example just call Class.forName([Driver]) before doing the getConnection call or check if the driver is available by doing a DriverManager.getDriver() call upfront and if not (exception thrown) call DriverManager.registerDriver().

Just to mention it: The getConnection call you do initially in BoneCP.obtainRawInternalConnection() will iniitialize the driver successfully as the method called in DriverManager line 576 will register the driver. But that's already inside the loop where it iterates over the available drivers so the iteration will stop before the index of the new driver and the "no suitable driver" exception is being thrown in DriverManager line 602. So afterwards BoneCP will be able to obtain connections using the driver which failed on the first call. But am not sure on the side effects it might have, because the exception is thrown inside the constructor of BoneCP.

Cheers,
Thomas