The method of setting up MySQL data source under Jboss4.0

Source: Internet
Author: User

How to use MySQL's data source in JBOSS4:

A MySQL-driven JDBC driver is placed in the classpath. Again, copy it to the/server/default/lib directory.

Two copies of the/docs/examples/jca/mysql-ds.xml to the/server/default/deploy directory. Modify Mysql-ds.xml file, set <driver-class/> to Com.mysql.jdbc.Driver <connection-url/> set to jdbc:mysql://< Mysqlhost>/<database>, where <mysqlhost> is the database host name <database> is the database name.

Three to replace the Docexamplesdocsexamplesjmsmysql-jdbc2-service D:javaonejboss4.0serverdefaultdeployjmshsqldb-jdbc2-service

Four then you need to set the <datasource> and <type-mapping> elements of the Defaultconfstandardjaws.xml file:

<jaws>
<datasource>java:/MySqlDS</datasource>
<type-mapping>mySql</type-mapping>
</jaws>

It is also necessary 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 more to modify the Login-config.xml file to use MySQL:

<application-policy name = "MySqlDbRealm">
<authentication>
<login-module code =
"org.jboss.resource.security.ConfiguredIdentityLoginModule"
flag = "required">
<module-option name ="principal">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>

Six Serverdefaultdeployejb-deployer.xml in the 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 other type to Bolb type

After this configuration, the default data source for JBoss 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.