How to set the MySql data source in Jboss4.0

Source: Internet
Author: User
How to set MySQL data source in Jboss4: Put a JDBC driver of MySQL into CLASSPATH. Similarly, copy it to the/server/default/lib directory and the/docs/examples/jca/mysql-ds.xml to the/server/default/deploy directory. Modify my

How to set the MySQL data source in Jboss4:

Put the JDBC driver of MySQL into CLASSPATH. Similarly, copy it to the/server/default/lib directory.

Copy/docs/examples/jca/mysql-ds.xml to the/server/default/deploy directory. Correct the mysql-ds.xml file and set <driver-class/> to com. mysql. jdbc. then, set <connection-url/> to jdbc: mysql: // <mysqlhost>/<database>, where <mysqlhost> is the database host name <database> is the database name.

Three doc \ examples \ docs \ examples \ jms \ mysql-jdbc2-service to change D: \ JavaOne \ jboss4.0 \ server \ default \ deploy \ jms \ hsqldb-jdbc2-service

4. set the <datasource> and <type-mapping> elements of the default \ conf \ standardjaws. xml file:

<Jaws>
<Datasource> java:/MySqlDS </datasource>
<Type-mapping> mySql </type-mapping>
</Jaws>

You also need to set the <datasource> and <datasource-mapping> elements of the standardjbosscmp-jdbc.xml file to the following:

<Jbosscmp-jdbc>
<Defaults>
<Datasource> java:/MySqlDS </datasource>
<Datasource-mapping> mySql </datasource-mapping>
</Defaults>
</Jbosscmp-jdbc>

Five and then modify the login-config.xml file to apply MySQL:

<Application-policy name = 'mysqldbrealm'>
<Authentication>
<Login-module code =
'Org. jboss. resource. security. ConfiguredIdentityLoginModule'
Flag = 'required'>
<Module-option name = 'prinal Al'> sa </module-option>
<Module-option name = 'username'> sa </module-option>
<Module-option name = 'password'> </module-option>
<Module-option name = 'managedconnectionfactoryname'>
Jboss. jca: service = LocalTxCM, name = MySqlDS
</Module-option>
</Login-module>
</Authentication>
</Application-policy>

In the \ server \ default \ deploy \ ejb-deployer.xml file

Create table TIMERS (
TIMERID varchar (50) not null,
TARGETID varchar (50) not null,
INITIALDATE timestamp not null,
INTERVAL bigint,
INSTANCEPK other,
INFO other,
Constraint timers_pk primary key (TIMERID)

Change the other type to the bolb type.

After such preparation, the default jboss data source is changed to MySQL.

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.