7.2.2. Installing the JDBC Driver and Deploying the DataSource

7.2.2. Installing the JDBC Driver and Deploying the DataSource

To make the JDBC driver classes available to JBoss, copy the file mysql-connector-java-3.0.15-ga-bin.jar from the Connector/J distribution to the lib directory in the default server configuration (assuming that is the configuration you’re running, of course). Then create a file in the deploy directory called mysql-ds.xml with the following datasource configuration. The database user name and password corresponds the MySql user we created in the previous section.

<datasources> 
    <local-tx-datasource> 
        <jndi-name>MySqlDS</jndi-name> 
        <connection-url>jdbc:mysql://localhost:3306/jboss</connection-url> 
        <driver-class>com.mysql.jdbc.Driver</driver-class> 
        <user-name>jboss</user-name> 
        <password>password</password> 
    </local-tx-datasource> 
</datasources> 

Because we have added a new JAR file to the lib directory, you will need to make sure that the server is able to find the MySQL driver classes.