Have a good question about JBoss 3.2.4 How to configure additional JDBC data sources for entity EJBs, online circulating Chinese literature version is "JBoss3.0 Configuration and Deploy EJB Introduction" (by huihoo.org Zhao Chenchi, zhaochenxi @ vip.sina. COM), due to rush or version difference, entity bean data source configuration chapter is subtle and 3.2.x version, causing many misunderstandings.
Here, Mr. Zhao is completed as follows:
Configure additional data sources in version 3.2.x, you need to deploy directory or EJB existence
1. Data type mapping files: 2. JDBC Data Source JNDI Registration File and Corresponding Data Source JAR3. EJB deployment file
The above documents have corresponding naming rules.
1. Data mapping file: You need to find data type mapping files in the JBOSS deployment directory
JBoss installation directory / server / default / conf /standardjbosscmp-jdbc.xml
Confirm that the DBMS data type to which you want to add a data source to the mapping settings of the Java data type. This is the mysql as an example. There should be a node
................ Remember that the type map name "mysql" is ready for use.
2. JDBC Data Source JNDI Registration File and Corresponding Data Source JAR 2-1 copies the corresponding JDBC JAR file to the JBoss installation directory / server / default / lib (JDBC MySQL-Connector-Java-3.1.1-Alpha- here) bin.jar as a MySQL JDBC) 2-2 Add JBOSS installation directory / server / default / deploy directory Add JDBC data source JNDI registration file, pay attention! This file must be named * -ds.xml! It is very easy to make mistakes here! Only the data source has a JNDI name, entity beans can create an correct JDBC instance. The registration file has corresponding format regulations. Sample files for common databases can be found in the JBOSS installation directory / DOCS / Examples / JCA directory. Take MySQL as an example, copy the JBoss installation directory / DOCS / EXAMPLES / JCA directory mysql-ds.xml to the JBoss installation directory / server / default / deploy directory: Take MySQL as an example, editing as follows: Examples: XML Version = "1.0" encoding = "UTF-8"?>
3. The EJB deployment file adds /meta-inf/jbosscmp-jdbc.xml file in the deployed entity EJB package. And fill in the relevant information:
Example Wen generates a deployment template for JBuilber X, including an entity bean be1 XML Version = "1.0" encoding = "UTF-8"?>
"http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_2.dtd"> Consistency, Note JBoss needs to attach a Java prefix -> At this point, copy the EJB directly to the deployment directory (JBoss installation directory / server / default / deploy). If you do not confirm the following file: Type mapping configuration file: JBoss installation directory / server / default / conf /standardjbosscmp-jdbc.xmljdb DRiver: JBoss installation directory / Server/default/lib/connector-java-3.1.1- Alpha-bin.jarjdbc driver jndi registration file: jboss installation directory /server/default/deploy/mysql-ds.xmlejb configuration file: EJB package /meta-inf/jbosscmp-jdbc.xml