no

JBoss datasource configuration settings

The following are sample configurations for different database (it's in the file standalone.xml subsystem=datasources): H2, postgresql,...

The following are sample configurations for different database (it's in the file standalone.xml subsystem=datasources):
H2, postgresql, mysql
<datasources>
 <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/PostgreDatasource" pool-name="PostgrePool" enabled="true" use-java-context="true" use-ccm="false">
  <connection-url>jdbc:postgresql://localhost:5432/postgre</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>postgre</user-name>
   <password>postgre</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/mysqlDataSource" pool-name="mysqlPool" enabled="true" use-java-context="true" use-ccm="false">
  <connection-url>jdbc:mysql://localhost:3306/mysql</connection-url>
  <driver-class>com.mysql.jdbc.Driver</driver-class>
  <driver>com.mysql</driver>
  <pool>
   <min-pool-size>2</min-pool-size>
   <max-pool-size>20</max-pool-size>
  </pool>
  <security>
   <user-name>mysql</user-name>
   <password>mysql</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 jndi-name="java:jboss/datasources/VmlaDS" pool-name="vmlaDS" enabled="true" use-java-context="true">
    <connection-url>jdbc:mysql://localhost:3306/vlma</connection-url>
    <driver>mysql</driver>
    <security>
        <user-name>vlma</user-name>
        <password>vlma</password>
    </security>
    <statement>
        <prepared-statement-cache-size>100</prepared-statement-cache-size>
        <share-prepared-statements>true</share-prepared-statements>
    </statement>
</datasource>
 <drivers>
<driver name="mysql" module="com.sql.mysql">
 <driver-class>com.mysql.jdbc.Driver</driver-class>
</driver>
  <driver name="h2" module="com.h2database.h2">
   <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
  </driver>
  <driver name="postgresql" module="org.postgresql">
   <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
  </driver>
   <driver name="com.mysql" module="com.mysql">
   <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
  </driver>
 </drivers>
</datasources>
<datasource jndi-name="java:jboss/datasources/germ-popperDS" pool-name="GermPopperPool" enabled="true" use-java-context="true">
 <connection-url>jdbc:jtds:sqlserver://localhost:1433/germpopper;loginTimeout=30;instance=sqlexpress</connection-url>
 <driver>JTDS</driver>
 <new-connection-sql>select 1</new-connection-sql>
 <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
 <pool>
  <min-pool-size>5</min-pool-size>
  <max-pool-size>50</max-pool-size>
 </pool>
 <security>
  <user-name>unicomi</user-name>
  <password>unicomi</password>
 </security>
 <validation>
  <check-valid-connection-sql>select 1</check-valid-connection-sql>
 </validation>
 <timeout>
  <set-tx-query-timeout>true</set-tx-query-timeout>
  <blocking-timeout-millis>5000</blocking-timeout-millis>
  <idle-timeout-minutes>15</idle-timeout-minutes>
 </timeout>
 <statement>
  <track-statements>false</track-statements>
 </statement>
</datasource>

Then add the following modules in: jboss-as-7.1.3.Final\modules
  1. postgresql
    1. create org/postgresql/main
    2. download and paste: postgresql-9.2-1002.jdbc4.jar
    3. create module.xml with these contents
    4. <?xml version="1.0" encoding="UTF-8"?>
      <module xmlns="urn:jboss:module:1.0" name="org.postgresql">
       <resources>
       <resource-root path="postgresql-9.2-1002.jdbc4.jar"/>
       </resources>
       <dependencies>
       <module name="javax.api"/>
       <module name="javax.transaction.api"/>
       </dependencies>
      </module>
  2. mysql
    1. create com/mysql/main
    2. download mysql-connector-java
    3. create module.xml with these contents
    4. <?xml version="1.0" encoding="UTF-8"?>  
      <module xmlns="urn:jboss:module:1.0" name="com.mysql">  
        <resources>  
       <resource-root path="mysql-connector-java-5.1.21.jar"/>  
        </resources>  
        <dependencies>  
       <module name="javax.api"/>  
        </dependencies>  
      </module>  
      
  3. MSSQL
  4. <driver name="JTDS" module="net.sourceforge.jtds">
     <driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class>
     <xa-datasource-class>net.sourceforge.jtds.jdbcx.JtdsDataSource</xa-datasource-class>
    </driver>
    

Related

server management 1486167062805430375

Post a Comment

item