Translator language:
This article introduces the configuration method of using various mainstream databases on JBoss4, and translated the purpose is to make it easy for everyone to use JBoss4 as a reference. I hope to help the majority of hobbies Java, hobby JBoss.
Foreword
The developer version of JBoss 4.0 is an open source application server, and he takes 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 parts:
l JBoss EJB deployment descriptor
l OralCe database configuration
l Mysql database configuration
l configuration of the sysbase database
l DB2 database configuration
l Infomix database configuration
JBoss EJB deployment descriptor
Standardjaws.xml (located 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 table of EJB mapping
l Describe the Finder method of EJB
l Description type mapping
The data source here is a JNDI name that can be obtained through this JNDI to obtain a data source connection pool. 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 configuration
Oracle is 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. The
Oracle OCI Type 2 Driver
Class: Oracle.jdbc.driver.Oracledriver
URL: JDBC: Oracle: OCI8: @
Oracle OCI Thin Type 4 Driver
Class: Oracle.jdbc.driver.OracleDriverURL: 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 the Connection URL
jaws>
Next, modify the StandardJbossCMP-JDBC.XML or JBOSSCMP-JDBC.XML configuration file, set
defaults>
jbosscmp-jdbc>
Finally, we need to modify the login-config.xml file to use Oracle, below is the
"Org.jboss.Resource.security.configuredIndityLoginmodule" Flag = "Required"> JBoss.jca: service = localtxcm, name = ORACLEDS Module-Option> login-module> authentication> application-policy> 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 JDBC: MySQL: // Then you need to set the jaws> Also need to set the defaults> jbosscmp-jdbc> Finally, modify the login-config.xml file to use MySQL: "Org.jboss.Resource.security.configuredIndityLoginmodule" Flag = "Required"> JBoss.jca: service = localtxcm, name = mysqlds module-option> login-module> authentication> application-policy> Modified mysql-ds.xml, standardjaws.xml, standardjbosscmp-jdbc.xml, and login-config.xml files can be used on JBOSS to use MySQL.