Switch JBoss default database to MySQL

Source: Internet
Author: User
Tags jboss

The default database for the JBOSS-3.2.3 uses hypersonic. For engineering use, we need to switch the database to a database with high performance such as MySQL and Oracle. What files need to be modified?

The following uses the MySQL database as an example to switch the default JBoss database to MySQL.

1. Slave.

2. You must delete the hsqldb-ds.xml under $ jboss_disc/Server/default/deploy, add a mysql-ds.xml file, and include the following content:

<? XML version = "1.0" encoding = "UTF-8"?>

<Datasources>
<Local-TX-datasource>
<JNDI-Name> defaultds </JNDI-Name>

<Connection-URL> JDBC: mysql: /localhost: 3306/test </connection-URL>
<Driver-class> com. MySQL. JDBC. Driver </driver-class>
<User-Name> test </user-Name>
<Password> test </password>
</Local-TX-datasource>
</Datasources>

The database name, user name, and password here are all replaced by test. You need to change it to the actual name.

In fact, the hsqldb-ds.xml here is not necessarily to delete, as long as the default name in the JNDI name defaultds does not conflict on the line.

 

3. Use $ jboss_disc/Server/default/deploy/JMS

Mysql-jdbc2-service.xml to replace the hsql-jdbc2-service.xml. Put

Modify defads ds to mysqlds. This file is responsible for persistent storage of message quene.

 

4. If you want to use the CMP feature, you have two ways to modify it: add the jbosscmp-jdbc.xml

In or modifying the EJB deployment unit

$ Jboss_disc/Server/default/CONF/standardjbosscmp-jdbc.xml, editing

Edit the element datasource-mapping to MySQL, as shown below:
<Jbosscmo-jdbc>
<Defaults>
<Datasource> JAVA:/defaultds </datasource>
<Datasource-mapping> mysql </datasource-mapping>
The second method is relatively simple, because you do not need to repackage the application. The disadvantage is that you must restart JBoss.

Now, restart JBoss to work in the MySQL database.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.