Create MySql datasource in JBoss

Create MySql datasource in JBoss | Javamazon:

Configuring a datasource for Microsoft SQL Server 2008

Download the Microsoft JDBC Driver 4.0 for SQL Server from here and put sqljdbc.jar from the sqljdbc_x.x distribution to the lib directory in the default server configuration
To create datasource for the MySql database inside the JBoss application server, you have to
first create mysql-ds.xml file with the following entries into the location \jboss-4.0.0\server\default\deploy:
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
  <local-tx-datasource>
  <jndi-name>DefaultDS</jndi-name>
  <connection-url>jdbc:sqlserver://localhost:1433;DatabaseName=appdb</connection-url>
  <driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
  <user-name>sa</user-name>
  <password>password</password>
  <check-valid-connection-sql>SELECT 1 FROM sysobjects</check-valid-connection-sql>
  <metadata>
   <type-mapping>MS SQLSERVER2008</type-mapping>
  </metadata>
  </local-tx-datasource>
</datasources>
Put mysql-ds.xml file under jboss-4.0.0\server\default\deploy. JBoss application server will
automatically take this file and create the datasource for you. You need not restart the JBOSS server.

0 comments:

Post a Comment