driver-class ignored?
lysy78 Aug 8, 2011 12:47 PMHello,
My environment is:
1. Java: jdk1.6.0_23
2. AS: jboss-6.0.0.Final
3. Database: MySQL 5.1
In order to connect to database it is needed to configure data source.
I created file mysql-ds.xml, and everything was ok.
But lately decided to use third party driver (different from original: com.mysql.jdbc.Driver), so I changed xml element driver-class. But nothing expected happened. So i decided to get the original environment and change value of driver-class element to something completely stupid: foo.bar.bla.bla.NotExistingDriver. And do you know what? - my data source was still ok. I didn't believe that.
Then I removed mysql connector jar, and i received exception:
java.lang.ClassNotFoundException: foo.bar.bla.bla.NotExistingDriver
Jboss did not find this class, becouse this class did and still does not exist. But after adding mysql connector jar to lib directory again, everything was ok again. Did it mean that this class was found in mysql connector jar? Strange.
This is my mysql-ds.xml:
<datasources> <local-tx-datasource> <jndi-name>TestDS</jndi-name> <connection-url>jdbc:mysql://localhost:3306/test</connection-url> <driver-class>foo.bar.bla.bla.NotExistingDriver</driver-class> <user-name>test</user-name> <password>test</password> <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name> <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class-name> <!-- <new-connection-sql>select * from test</new-connection-sql> --> <!-- sql to call on an existing pooled connection when it is obtained from pool - MySQLValidConnectionChecker is preferred for newer drivers <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql> --> <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) --> <metadata> <type-mapping>mySQL</type-mapping> </metadata> </local-tx-datasource> </datasources>
So... the question is:
Is the element driver-class ignored by jboss?
Could anyone explain it to me, please?
Thanks in advance
Hubert