Hi All,
Here I am going to show you the steps to configure JBoss 5.1.GA Application Server with mysql 5.1 Database as a default data source. When you download JBoss Application Server at that time the default database is hsql. So, here are the step to configure mysql database instead of hsql:
1. create database schema in your mysql server. i.e jboss_as
2. Before proceed with mysql configuration, copy mysql jar file to <JBOSS_HOME>\server\default\lib
location.Here I am going to show you the steps to configure JBoss 5.1.GA Application Server with mysql 5.1 Database as a default data source. When you download JBoss Application Server at that time the default database is hsql. So, here are the step to configure mysql database instead of hsql:
1. create database schema in your mysql server. i.e jboss_as
2. Before proceed with mysql configuration, copy mysql jar file to <JBOSS_HOME>\server\default\lib
3. Now, make mysql-ds.xml file and copy following contents in it. But before doing it you need to disable hsql-ds.xml file. Don't delete it. Just change it to hsql-ds.xml.sample by giving it .sample extension.
<?xml version="1.0" encoding="UTF-8"?> <datasources> <local-tx-datasource> <jndi-name>DefaultDS</jndi-name> <connection-url>jdbc:mysql://localhost:3306/schema_name</connection-url> <driver-class>com.mysql.jdbc.Driver</driver-class> <user-name>root</user-name> <password>XXXXXXX</password> <min-pool-size>5</min-pool-size> <max-pool-size>20</max-pool-size> <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation> <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name> <valid-connection-checker-classname>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-classname> <metadata> <type-mapping>mySQL</type-mapping> </metadata> </local-tx-datasource> </datasources>
4. Now, you also need to add mysql-persistence-service.xml file to <JBOSS_HOME>\server\default\deploy\messaging location. You will find this file at <JBOSS_HOME>\docs\examples\jms location. Just copy this file and paste it in messaging folder. One thing you need to do over here is disable the hsql-persistence-service.xml file by making it hsql-persistence-service.xml.sample
Once you are done with the above steps, just restart the JBoss.
After successful start up, you will see the tables to be created under your defined schema in mysql-ds.xml file.
That's it..!!!!
Happy Coding..!!!
No comments:
Post a Comment