JBoss v.s. Tomcat JDBC driver registration discrepency?

The automatic JDBC driver registration depends on the Driver implementation providing a static initializer block that invokes DriverManager. RegisterDriver(...) the block is invoked only when the Driver class is loaded. Chances are that the driver implementation does not have such a static initializer, or that the application server is not loading the class (unlikely).

Up vote 0 down vote favorite share g+ share fb share tw.

I have a JDBC drive that I used to use just fine with JBoss 7 I have since switched to Tomcat (also v7) for faster deployment while debugging and noticed that the same JDBC driver was not loaded automatically anymore. I had to register it manually myself, which then worked. Is this a lmiitation in Tomcat that doesn't exist in JBoss?

I had thought that JBoss uses Tomcat internally.... P. S: I am running everything against JRE 1.6 so automatic registration should be a given. Java tomcat jdbc jboss registration link|improve this question asked Sep 13 '11 at 17:04Ayyoudy590313 82% accept rate.

The automatic JDBC driver registration depends on the Driver implementation providing a static initializer block that invokes DriverManager. RegisterDriver(...); the block is invoked only when the Driver class is loaded. Chances are that the driver implementation does not have such a static initializer, or that the application server is not loading the class (unlikely).

If the driver claims to be a JDBC 4.0 compliant driver, consider filing a bug if there is no static initializer block, as Section 9.2 of the JDBC 4.0 specification specifically states (emphasis mine): JDBC drivers must implement the Driver interface, and the implementation must contain a static initializer that will be called when the driver is loaded. This initializer registers a new instance of itself with the DriverManager, as shown in CODE EXAMPLE 9-1. Public class AcmeJdbcDriver implements java.sql.

Driver { static { java.sql.DriverManager. RegisterDriver(new AcmeJdbcDriver()); } ... } CODE EXAMPLE 9-1 Example static initializer for a driver implementing java.sql.Driver.

I don't think you read my question properly. I know all about this. I am saying the drive is registered AUTOMATICALLY with no issues in JBoss 7 but requires manual registeation via the DriverManager.registerDriver() when used under Tomcat 7... my question is WHY the discrepency since I think JBoss is based on Tomcat... This isn't an issue with the driver since JBoss can register it automatically just fine.

– Ayyoudy Sep 13 '11 at 18:07 @Ayyoudy, I don't think you have read my answer properly. Read it once again. Decompile the driver if you have to, and see why the registration process fails in Tomcat and not in JBoss.

Alas, there is only so much I can advocate if you do not want to post details of the driver. – Vineet Reynolds Sep 13 '11 at 18:44.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions