Looking for a JavaEE Architect or Potential Tech Co-Founder?
Please don't hesitate to contact me.

How to setup your datasource in Jboss7.x

Below are sample configurations you can use to setup postgresq, mysql data source in your jboss7.x.

Where to add:
1.) If you added Jboss Tools plugin to eclipse, in server view expand Jboss Server->Filesets->Configuration->standalone.xml

2.) Otherwise you can find standalone.xml in JBOSS_HOME/standalone/configuration.

<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
  <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url>
  <driver>h2</driver>
  <security>
   <user-name>sa</user-name>
   <password>sa</password>
  </security>
 </datasource>
 <datasource jta="false" jndi-name="java:jboss/datasources/DropshipDataSource" pool-name="dropshipPool" enabled="true" use-java-context="true" use-ccm="false">
  <connection-url>jdbc:postgresql://localhost:5432/dropship</connection-url>
  <driver-class>org.postgresql.Driver</driver-class>
  <driver>postgresql</driver>
  <pool>
   <min-pool-size>2</min-pool-size>
   <max-pool-size>20</max-pool-size>
  </pool>
  <security>
   <user-name>user</user-name>
   <password>user</password>
  </security>
  <validation>
   <validate-on-match>false</validate-on-match>
   <background-validation>false</background-validation>
   <background-validation-millis>1</background-validation-millis>
  </validation>
  <statement>
   <prepared-statement-cache-size>10</prepared-statement-cache-size>
   <share-prepared-statements>false</share-prepared-statements>
  </statement>
 </datasource>
 <datasource jta="false" jndi-name="java:jboss/datasources/MeveoAdminDatasource" pool-name="meveoDS" enabled="true" use-java-context="true" use-ccm="false">
  <connection-url>jdbc:postgresql://localhost:5432/meveo</connection-url>
  <driver-class>org.postgresql.Driver</driver-class>
  <driver>postgresql</driver>
  <pool>
   <min-pool-size>2</min-pool-size>
   <max-pool-size>20</max-pool-size>
  </pool>
  <security>
   <user-name>user</user-name>
   <password>user</password>
  </security>
  <validation>
   <validate-on-match>false</validate-on-match>
   <background-validation>false</background-validation>
   <background-validation-millis>1</background-validation-millis>
  </validation>
  <statement>
   <prepared-statement-cache-size>10</prepared-statement-cache-size>
   <share-prepared-statements>false</share-prepared-statements>
  </statement>
 </datasource>
 <datasource jta="false" jndi-name="java:jboss/datasources/MeveoDWHDatasource" pool-name="meveoDWHDS" enabled="true" use-java-context="true" use-ccm="false">
  <connection-url>jdbc:postgresql://localhost:5432/meveodwh</connection-url>
  <driver-class>org.postgresql.Driver</driver-class>
  <driver>postgresql</driver>
  <pool>
   <min-pool-size>2</min-pool-size>
   <max-pool-size>20</max-pool-size>
  </pool>
  <security>
   <user-name>user</user-name>
   <password>user</password>
  </security>
  <validation>
   <validate-on-match>false</validate-on-match>
   <background-validation>false</background-validation>
   <background-validation-millis>1</background-validation-millis>
  </validation>
  <statement>
   <prepared-statement-cache-size>10</prepared-statement-cache-size>
   <share-prepared-statements>false</share-prepared-statements>
  </statement>
 </datasource>
 <drivers>
  <driver name="h2" module="com.h2database.h2">
   <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
  </driver>
  <driver name="com.mysql" module="com.mysql">
   <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
  </driver>
  <driver name="postgresql" module="org.postgresql">
   <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
  </driver>
 </drivers>
</datasources>
How to setup your datasource in Jboss7.x How to setup your datasource in Jboss7.x Reviewed by Edward Legaspi on Wednesday, May 22, 2013 Rating: 5

No comments:

Powered by Blogger.