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.