Configuring a database for JBoss4

xiaoxiao2021-03-06  37

Configuring a database for JBoss4

Configure the basic procedure of the database connection with JBoss4 (excluding XA data connections):

1. COPY Database JDBC driver to the lib directory in the deployment folder

2. Establish the physical database table that needs to be connected.

3. Establish a database profile, configure the database parameters, and the file is ended in -ds.xml, such as mysql-ds.xml. Configuration file specific method Refer to DOCS / EXAMPLE / JCA, there are routines of various databases. Only a few common configurations are described here. Modifying a good profile is placed in a web application deployment directory, such as the web app is all, put it under $ JBOSS4_HOME / Server / All / Deploy.

4. The CMP configuration file of the transition JBoss jbosscmp-jdbc.xml parameter. General modification

Java: / Defaultds

mysql

These two parameters, convert the defaultds to the value of in the -ds.xml file, will

DataSource-mapping is changed to the value of in the -ds.xml file.

5. Start JBoss, test database connection

One. Mysql

The default routine in the JBoss4 document is Mysql example. (See Chapter 85)

1. MySQL's JDBC driver Connector / J can be downloaded at http://www.mysql.com.

Now the latest mysql is 4.1, and Connector / J is 3.2. Corresponding to the following address, respectively

http://dev.mysql.com/downloads/mysql/4.1.html

http://dev.mysql.com/downloads/connector/j/3.2.html

When downloaded, I feel that the speed of several sites in Korea is the fastest.

(BTW: Taiwan site actually has a blue sky, must protest with JBoss)

2. Create a database in the mysql client called Test

Mysql> Create Database Test;

3. Create a mysql-ds.xml file

Defaultds

JDBC: MySQL: // Localhost: 3306 / Test

com.mysql.jdbc.driver

Username

Password

mysql

You can also copy the mysql-ds.xml of DOCS / EXAMPLE / JCA. Save under Deploy. And remove JBoss default HSQLDB-DS.XML.

4. Open JBossCMP-JDBC.XML,

Java: / Defaultds Hypersonic SQL ->

change into

Java: / Defaultds

mysql

5. Start JBoss. If your own web is applied to all, use Run -C All

two. Oracle

Oracle's database driver can be found in Oracle's installation directory, ojdbc14.jar or ojdbc14_g.jar under Oracle / ORA92 / JDBC / LIB.

Establish Oracle-DS.xml, pay attention to Oracle's URL

JDBC: Oracle: Thin: @YOOURACLEHOST: 1521: Yoursid

three. SQLServer2000

SQLSERVER2000 database driver can be found in the Microsoft website, including three files

Msbase.jar, mssqlserver.jar and msutil.jar, establish MSSQL-DS.XML, SQLServer2000's URL is

JDBC: Microsoft: SQLServer: // localhost: 1433; DatabaseName = MyDatabase

com.microsoft.jdbc.sqlserver.sqlserverdriver

If you use WebLogic's SQLServer2000 driver, it is under BEA / WebLogic81 / Server / Lib

MSSQLSERVER4V65.JAR, CLASS is WebLogic.JDBC.MSSQLSERVER4.DRIVER

转载请注明原文地址:https://www.9cbs.com/read-66466.html

New Post(0)