Use Jboss to configure source code

Source: Internet
Author: User

Jboss 4.0 is an open-source application server that uses HypersonicDB as its default database. However, developers may also need to use other types of databases except HypersonicDB. In this article, we will see how to configure other databases on Jboss.

Introduction

Jboss4.0 uses the JDBC configuration file to configure database connections. It provides data sources for access between ejbs and other J2EE applications. If you want to use a database other than HypersonicDB, You need to modify this configuration file. This article focuses on the following parts:
L Jboss EJB deployment descriptor
L Oralce Database Configuration
L MySQL Database Configuration
L Sysbase Database Configuration
L DB2 database configuration
L Infomix Database Configuration

Jboss EJB deployment descriptor

Standardjaws. xml (located at X: \ jboss4 \ server \ default \ conf) is a standard deployment description file mapped to the CMP Entity EJB. It is used to configure the CMP Entity EJB. You can also use jaws. xml instead. You can copy this file to the META-INF directory in the ejb. jar file. This file is used to describe the following information:
L describes a data source and ing type.
L description of the EJB ing table
L description of the EJB finder Method
L description type ing
The data source here describes a JNDI name, which can be used to obtain a data source connection pool. Jboss4 uses HypersonicDB by default. If other data sources are used, you need to modify the jaws. xml file.
The standardjbosscmp-jdbc.xml (located at X: \ jboss4 \ server \ default \ conf) is the standard deployment description file for configuring the Jboss CMP container, you can also replace it with a custom profile -- jbosscmp-jdbc.xml. This file is also placed in the META-INF directory of the EJB. jar file. HypersonicDB is used as the database by default, which also needs to be modified here.

Oracle Database Configuration

Oracle has become a very popular enterprise-level database for its stability and reliability. To configure Oracle on Jboss, copy the JDBC driver of Oracle to ClassPath. Copy the JDBC driver to the server/default/lib directory. To use Oracle's transaction processing data source, we also need to copy/docs/examples/jca/oracle-xa-ds.xml to the/server/default/deploy directory. If you are using 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 <driver-class/> label and <connection-url/> label are set as follows:

Oracle OCI Type 2 Driver
Class: oracle. jdbc. driver. OracleDriver
URL: jdbc: oracle: oci8: @ <database>
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: @ <database>

In the Connection URL,

<Jaws>
<Datasource> java:/OracleDS </datasource>
<Type-mapping> Oracle8 </type-mapping>
</Jaws>

Next, modify the standardjbosscmp-jdbc.xml or jbosscmp-jdbc.xml profile and set the <datasource> and <datasource-mapping> elements to use Oracle.

<Jbosscmp-jdbc>
<Defaults>
<Datasource> java:/OracleDS </datasource>
<Datasource-mapping> Oracle8 </datasource-mapping>
</Defaults>
</Jbosscmp-jdbc>

  • 1
  • 2
  • 3
  • Next Page

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.