[jboss-user] [Datasource Configuration] - driver-class ignored?

Hubert Lyczek do-not-reply at jboss.com
Mon Aug 8 12:48:05 EDT 2011


Hubert Lyczek [http://community.jboss.org/people/lysy78] created the discussion

"driver-class ignored?"

To view the discussion, visit: http://community.jboss.org/message/619933#619933

--------------------------------------------------------------
Hello,

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
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/619933#619933]

Start a new discussion in Datasource Configuration at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2077]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110808/5ffe2d2c/attachment.html 


More information about the jboss-user mailing list