Configure Oracle data sources in JBoss 7
I. jboss7 directory structure
In JBoss 7, the file system is divided into two parts:
1. Independent Server
2. Domain Server (first introduced in JBoss 7)-used for unified management of multiple instances
BIN: contains the startup script used to start an independent server (if an independent instance is used) or a domain (using a Domain Server)
DOCS: contains the server documentation, which has two sub-directories: Licenses (licenses. xml and related content) and Schema (The. xsd file used for configuration)
DOMAIN: contains the DOMAIN structure and sub-directories: configuration (including the DOMAIN configuration file), data (including the content folder of the published module), lib (used to support Java EE extension) tmp (temporary directory ).
STANDALONE: The structure is the same as the Domain folder
MODULES: Because JBoss 7 is a modular server, the module of the Application Server corresponds to a sub-directory.
Ii. Data Source Configuration
A. Download The Oracle10g JDBC driver-ojdbc6.jar
B. Place the jar file in the jboss7 Folder \ modules \ com \ oracle \ main (oracle, main) to create a new folder.
C. Compile the module. xml file code in the main file as follows:
<Span style = "font-family: FangSong_GB2312;"> <? Xml version = "1.0" encoding = "UTF-8"?>
<Module xmlns = "urn: jboss: module: 1.0" <span style = "color: # ff0000;"> name = "com. oracle" </span>
<Resources>
<! -- Insert resources here -->
<Resource-root path = "<span style =" color: #33cc00; "> ojdbc6.jar </span>"/>
</Resources>
<Dependencies>
<Module name = "javax. api"/>
<Module name = "javax. transaction. api"/>
</Dependencies>
</Module> </span>
D. After completing the preceding steps, modify the datassource modification in the standalone \ configuration file in the jboss7 folder.
The Code is as follows:
<Span style = "font-family: FangSong_GB2312;"> <subsystem xmlns = "urn: jboss: domain: CES: 1.0">
<Datasources>
<Datasource jndi-name = "myDS" pool-name = "myDS" enabled = "true" jta = "true" use-java-context = "true" use-ccm =" true ">
<Connection-url> jdbc: oracle: thin: @ address: 1521: Instance name </connection-url>
<Driver-class> oracle. jdbc. driver. OracleDriver </driver-class>
<Driver> <span style = "color: #000099;"> oracle </span> </driver>
<Pool>
<Min-pool-size> 30 </min-pool-size>
<Max-pool-size> 50 </max-pool-size>
<Prefill> true </prefill>
<Use-strict-min> false </use-strict-min>
<Flush-strategy> FailingConnectionOnly </flush-strategy>
</Pool>
<Security>
<User-name> sa </user-name>
<Password> sa </password>
</Security>
</Datasource>
<Drivers>
<Driver <span style = "color: #000099;"> name = "oracle" </span> <span style = "color: # ff0000;"> module = "com. oracle </span> ">
<Xa-datasource-class> oracle. jdbc. xa. client. OracleXADataSource </xa-datasource-class>
</Driver>
</Drivers>
</Datasources>
</Subsystem> </span>
Iii. Summary
Compared with the old version of jboss, the new version of jboss integrates two new concepts: one is managing multiple servers through domain, and the other is a modular concept. With the modular concept, the new version of the data source does not put the mysql data source driver in the specified lib directory as before, copy a data source configuration file and change it to the deployment directory, in the new version, the data source needs to be integrated into jboss in a modular manner. Therefore, the basis for configuring the data source still needs to understand the modular concept in the new version of jboss. Of course, the configuration of mysql and other database data sources is the same as the above steps.
Hot deployment of earlier versions of JBoss to JBoss7
This article permanently updates the link address: