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:
JBoss EJB deployment descriptor
Oralce database configuration
Mysql database configuration
Sysbase database configuration
DB2 database configuration
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:
Describe a data source and mapping type
Describe the table of EJB mapping
Describe the Finder method of EJB
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 settings of the labels and labels are as follows:
Oracle OCI Type 2 DriverClass: Oracle.jdbc.driver.Oracledriver URL: JDBC: Oracle: OCI8: @
Next, modify StandardJbossCMP-JDBC.XML or JBossCMP-JDBC.XML configuration files, settings, and elements to use Oracle.
Finally, we need to modify the login-config.xml file to use Oracle, below is the element of the login-config.xml file:
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 to com.mysql.jdbc.driver and set it to
JDBC: MySQL: ///, where the database hostname is the database name.
Then you need to set the and elements of Standardjaws.xml or Jaws.xml files:
Also need to set StandardJbosscmp-JDBC.XML or JBossCMP-JDBC.XML files to the following:
Finally, modify the login-config.xml file to use MySQL:
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 and set it to JDBC: Sybase: TDS :: /, which is the host name, port name, and database name. Also need to modify the and elements of Standardjaws.xml or Jaws.xml files:
Modify StandardJbossCMP-JDBC.XML or JBossCMP-JDBC.XML files and elements:
Finally modify the login-config.xml file to use the SYSBASE database. Set the element:
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 the element bit com.ibm.db2.jdbc.app.db2driver, element is JDBC: DB2: The element represents Database service name.
Here is the corresponding StandardJbosscmp-JDBC.XML (or JBossCMP-JDBC.XML) file:
Finally, add the following in the Login-Config.xml file:
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, set the element to: com.informix.jdbc.iFxDriver Set the element to
JDBC: Informix-Sqli: // :: Informix Server =,
Among them,, in the name of the database hostname, database port, and database service name, respectively. Then modify the and elements of StandardJaws.xml or Jaws.xml files:
Set the and elements in StandardJbosscmp-JDBC.XML or JBossCMP-JDBC.XML files:
Finally join in login-config.xml file element:
This way, 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.