JBoss AS 7 : Datasource
Par PlaceOweb le samedi, juillet 16 2011, 20:18 - JAVA - Lien permanent
How to configure a Datasource with JBoss 7?
JBoss AS 7 : Create, configure and deploy a MySQL datasource
With JBoss7, you need to register the com.mysql module under the new modules/com/mysql/main folder. There you need to add two files: the module.xml definition and the JDBC jar library.
modules +---com ¦ +---mysql ¦ ¦ +---main ¦ ¦ +---module.xml ¦ ¦ +---mysql-connector-java-5.1.18-bin.jar
jboss-as-7/modules/com/mysql/main/module.xml
<module xmlns="urn:jboss:module:1.0" name="com.mysql"> <resources> <resource-root path="mysql-connector-java-5.1.18-bin.jar"/> </resources> <dependencies> <module name="javax.api"/> <module name="javax.transaction.api"/> </dependencies> </module>
Configure your datasources
C:\jboss-as-7\standalone\configuration\standalone.xml
<subsystem xmlns="urn:jboss:domain:datasources:1.0"> <datasources> //... <drivers> <driver name="mysql" module="com.mysql"/> </drivers> <datasource jndi-name="java:/MySqlDS" pool-name="MySQLPoolFirstPoolName"> <connection-url>jdbc:mysql://localhost:3306/myDB</connection-url> <driver>mysql</driver> <pool> <max-pool-size>30</max-pool-size> </pool> <security> <user-name>myMysqlUser</user-name> <password>myMysqlPassword</password> </security> </datasource> //... </datasources>
Ressources
DataSource Jboss 7
- JBoss AS 7 : Création, configuration et déploiement d'un datasource connecté à MySQL
- Data Source Configuration in AS 7
- How to configure a Datasource with JBoss 7
- How do I migrate my application from AS5 or AS6 to AS7 Update the DataSource Configuration, Define the datasource, Install the JDBC driver, Installing a JDBC Driver as a Deployment, Configure the datasource for Hibernate or JPA, Update application JNDI namespace names, Modify your application code to follow the new JNDI namespace rules