JBoss4 data source configuration

xiaoxiao2021-03-06  111

http://www.onjava.com/pub/a/onjava/2004/02/25/25/Jbossjdbc.htmljboss 4.0 Developer Version is an open source application server, he puts HyperSonicDB as his default database. However, developers may also use a database other than HyperSonicDB, in which we will see how to configure other databases on JBoss. Introduction JBoss4.0 uses a JDBC profile to configure database connections, which provides data sources for EJBs and other J2EE applications. If you want to use the database other than HypersonicDB, you will modify this profile. This article will focus on the following sections: l JBoss EJB Deployment Descriptor L Oralce Database Configuration L MYSBASE Database Configuration L DB2 Database Configuration L infromix database configuration

JBoss's EJB deployment descriptor Standardjaws.xml (in x: / jboss4 / server / default / conf) is a standard deployment description file that maps CMP entity EJB. It is used to configure CMP entity EJB, you can also use jaws.xml instead. You can copy this file Copy to the meta-inf directory in the EJB .jar file. This file is used to describe the following information: l Describe a data source and mapping type. l Describe the EJB mapping table L Describes the Finder method L of EJB to describe the type map The data source described here is a JNDI name, which can obtain a data source connection pool by this JNDI. JBoss4 default data sources are HypersonicDB. If you need to use other data sources, you need to modify the jaws.xml file. Standardjbosscmp-jdbc.xml (in x: / jboss4 / server / default / conf) is a standard deployment description file configured for the JBoss CMP container, you can also use a custom profile -jbosscmp-jdbc.xml instead of it. This file is also placed in the meta-INF directory of the EJB.jar file. It is also a need to modify it by default or hypersonicDB as a database. Oracle Database Configuring Oracle has a very popular enterprise database with its operational stability and reliability. To configure Oracle on JBOSS, what is the first thing we have to do is to copy the Oracle's JDBC driver to ClassPath. We copied this JDBC driver to the server / default / lib directory. In order to use Oracle's transaction processing data source we must also copy /DOCS/examples/jca/oracle-xa-ds.xml to the / Server / Default / Deploy directory. If you use a non-transactional data source, copy the /DOCS/examples/jca/oracle-ds.xml file to the / Server / Default / Deploy directory. Next, we need to modify the Oracle-de.xml configuration file. one of them

Label and

The label settings are as follows: Oracle OCI Type 2 Driverclass: Oracle.jdbc.driver.OrgLEDriver URL: JDBC: Oracle: OCI8: @

Oracle OCI Thin Type 4 Driver

Class: Oracle.jdbc.driver.Oracledriver

URL: JDBC: Oracle: Thin: @

:

:

Oracle OCI XA Type 2 Driver

Class: Oracle.jdbc.xa.client.OraclexADataSource

URL: JDBC: Oracle: Thin: @

:

:

Oracle OCI Type 2 Driver

Class: Oracle.jdbc.driver.Oracledriver

URL: JDBC: Oracle: OCI8: @ in Connection URL

Is the computer host name installed in Oracle,

Is the port of the Oracle database,

Is the database name. Next, we will modify the StandardJaws.xml or Jaws.xml configuration file and put

with

This is just the following:

Java: / oracleds

Oracle8

Next, modify StandardJbossCMP-JDBC.XML or JBossCMP-JDBC.XML configuration files, set

with

Elements use oracle.

Java: / Oracleds

Oracle8

Finally, we need to modify the login-config.xml file to use Oracle, below is login-config.xml file

element:

"Org.jboss.Resource.security.configuredIndityLoginmodule"

Flag = "Required">

SA

SA

JBoss.jca: service = localtxcm, name = ORACLEDS

Modified Oracle-DS.xml, Standardjaws.xml, Standardjbosscmp-jdbc.xml, and

After the login-config.xml file, you can use Oracle in jboss4.

MySQL database configuration

MySQL is an open source database, with many open source projects and small communities are using it. To use MySQL in JBoss4, first you want to put the mysql JDBC in the classpath. Similarly, copy it to the / server / default / lib directory, copy /DOCS/examples/jca/mysql-ds.xml to the / Server / Default / Deploy directory. Modify the mysql-ds.xml file, set

For com.mysql.jdbc.driver

Set as

JDBC: mysql: //

/

,among them

Is the database host name

It is the database name.

Then you need to set Standardjaws.xml or Jaws.xml files.

with

element:

Java: / mysqlds mysql

It also needs to put the standardjbosscmp-jdbc.xml or jbosscmp-jdbc.xml file

with

The element is set to the following:

Java: / mysqlds

mysql

Finally modify the login-config.xml file to use mysql:

"Org.jboss.Resource.security.configuredIndityLoginmodule"

Flag = "Required">

SA

SA

JBoss.jca: service = localtxcm, name = mysqlds

Modified mysql-ds.xml, standardjaws.xml, standardjbosscmp-jdbc.xml, and

Login-config.xml files can be used on JBOSS using mysql.

SYSBASE database configuration

Sybase Adaptive Server Enterprises (ASE) is the Sysbase's database server. ASE can be used on UNIX and Linux platforms. Similarly, we have to drive its database to the classpath, copy it into the / server / default / lib directory, then copy the /DOCS/examples/jca/sybase-ds.xml to / Server / Default / Deploy directory . Modify the Sybase-DS.xml file

Set to com.sybase.jdbc2.jdbc.sybdriver

Set to JDBC: Sybase: TDS:

:

/

,among them

The host name, port name, and database name, respectively. Also need to modify Standardjaws.xml or Jaws.xml files

with

element:

Java: / Sybaseds

Sybase

modify the StandardJbossCMP-JDBC.XML or JBossCMP-JDBC.XML files and

element:

Java: / Sybaseds

Sybase

Finally modify the login-config.xml file to use the SYSBASE database. Set

element:

"Org.jboss.Resource.security.configuredIndityLoginmodule"

Flag = "Required">

SA

SA

JBoss.jca: service = localtxcm, name = Sybaseds

Modified Sybase-DS.xml, Standardjaws.xml, Standardjbosscmp-jdbc.xml, and

After the login-config.xml file, you can use Sysbase in JBOSS.

DB2 database configuration

IBM's DB2 is a perfect, easy to use the database server, which can be used on Linux, UNIX, and Windows platforms. Use DB2 on JBoss4 as long as you copy db2java.zip to the / Server / Default / Lib directory. Then copy the /DOCS/examples/jca/db2-ds.xml to / Server / Default / Deploy directory, then modify

Element position com.ibm.db2.jdbc.app.db2driver,

Element is JDBC: DB2: where

Elements represent database service names.

Java: / db2ds

DB2

Here is the corresponding StandardJbosscmp-JDBC.XML (or JBossCMP-JDBC.XML) file:

Java: / db2ds

DB2

Finally, add the following content in the Login-Config.xml file:

"Org.jboss.Resource.security.configuredIndityLoginmodule"

Flag = "Required">

Principal> SA

"Username"> SA

"Password">

JBoss.jca: service = localtxcm, name = db2ds

You can use DB2 on JBOSS on JBOSS.

Informix database configuration

IBM's INFOXMIX database server is used as a data warehouse, analysis and reporting. Use the Informix database on JBoss4, first copy it to the / server / default / lib directory, then copy / serve / default / deploy In the directory, if you use a transaction (XA) JDBC, copy the /DOCS/examples/jca/informix-xa-ds.xml file.

The next step is to modify this informix-ds.xml file, put

The element is set to: com.informix.jdbc.ifxdriver

Element is set to

JDBC: Informix-Sqli: //

:

: InformixServer =

,

among them,

,

,

Represents the database hostname, database port, and database service name, respectively. Then modify the StandardJaws.xml or Jaws.xml file

with

element:

Java: / InformixDs

informixdb

Put the standardjbosscmp-jdbc.xml or jbosscmp-jdbc.xml file

with

The element is set to the following:

Java: / InformixDs

informixdb

Added in the login-config.xml file

element:

"Org.jboss.Resource.security.configuredIndityLoginmodule"

Flag = "Required">

SA

SA

JBoss.jca: service = localtxcm, name = informixds

You can use the Informix database in JBoss4.

in conclusion

JBoss4 uses the Hypersonic database by default, but if you see us as long as you have a simple modification of several configuration files, you can use the popular different databases on the market.

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

New Post(0)