JBoss.orgCommunity Documentation

Appendix C. Datasources

The datasource schema can found at http://www.jboss.org/ironjacamar/schema/datasources_1_0.xsd.



      <?xml version="1.0" encoding="UTF-8"?>
<!-- See http://www.jboss.org/community/wiki/Multiple1PC for information about datasource -->
<datasources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:noNamespaceSchemaLocation="http://www.jboss.org/ironjacamar/schema/datasources_1_0.xsd">

  <datasource jndi-name="PostgresDS" pool-name="PostgresDS">
    <connection-url>jdbc:postgresql://[servername]:[port]/[database name]</connection-url>
    <driver-class>org.postgresql.Driver</driver-class>
    <security>
      <user-name>x</user-name>
      <password>y</password>
    </security>
    <validation>
      <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"></valid-connection-checker>
      <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"></exception-sorter>
    </validation>
  </datasource>

</datasources>

    


      <?xml version="1.0" encoding="UTF-8"?>

<datasources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:noNamespaceSchemaLocation="http://www.jboss.org/ironjacamar/schema/datasources_1_0.xsd">

  <xa-datasource jndi-name="PostgresDS" pool-name="PostgresDS">
    <xa-datasource-property name="ServerName">server_name</xa-datasource-property>
    <xa-datasource-property name="PortNumber">5432</xa-datasource-property>
    <xa-datasource-property name="DatabaseName">database_name</xa-datasource-property>
    <xa-datasource-property name="User">user</xa-datasource-property>
    <xa-datasource-property name="Password">password</xa-datasource-property>
    <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
    <validation>
      <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"></valid-connection-checker>
      <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"></exception-sorter>
    </validation>
  </xa-datasource>

</datasources>

    


      <?xml version="1.0" encoding="UTF-8"?>
<!-- See http://www.jboss.org/community/wiki/Multiple1PC for information about datasource -->

<datasources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:noNamespaceSchemaLocation="http://www.jboss.org/ironjacamar/schema/datasources_1_0.xsd">

  <datasource jndi-name="MySqlDS" pool-name="MySqlDS">
    <connection-url>jdbc:mysql://mysql-hostname:3306/jbossdb</connection-url>
    <driver-class>com.mysql.jdbc.Driver</driver-class>
    <security>
      <user-name>x</user-name>
      <password>y</password>
    </security> 
    <validation>
      <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"></valid-connection-checker>
      <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"></exception-sorter>
    </validation>
  </datasource>

</datasources>

    


      <?xml version="1.0" encoding="UTF-8"?>

<datasources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:noNamespaceSchemaLocation="http://www.jboss.org/ironjacamar/schema/datasources_1_0.xsd">

  <xa-datasource jndi-name="MysqlXADS" pool-name="MysqlXADS">
    <xa-datasource-property name="ServerName">server_name</xa-datasource-property>
    <xa-datasource-property name="DatabaseName">database_name</xa-datasource-property>
    <xa-datasource-property name="User">user</xa-datasource-property>
    <xa-datasource-property name="Password">password</xa-datasource-property>
    <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
    <validation>
      <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"></valid-connection-checker>
      <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"></exception-sorter>
    </validation>
  </xa-datasource>

</datasources>

    


      <?xml version="1.0" encoding="UTF-8"?>

<datasources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:noNamespaceSchemaLocation="http://www.jboss.org/ironjacamar/schema/datasources_1_0.xsd">

  <datasource jndi-name="java:/H2DS" pool-name="H2DS">
    <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url>
    <driver-class>org.h2.Driver</driver-class>
    <security>
      <user-name>sa</user-name>
      <password>sa</password>
    </security>
  </datasource>

</datasources>

    


      <?xml version="1.0" encoding="UTF-8"?>

<datasources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:noNamespaceSchemaLocation="http://www.jboss.org/ironjacamar/schema/datasources_1_0.xsd">

  <xa-datasource jndi-name="java:/H2XADS" pool-name="H2XADS">
    <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
    <xa-datasource-property name="URL">jdbc:h2:mem:test</xa-datasource-property>
    <security>
      <!-- Have to defined as a primary property - otherwise it won't work -->
      <user-name>sa</user-name>
      <!-- Have to defined as a primary property - otherwise it won't work -->
      <password>sa</password>
    </security>
  </xa-datasource>

</datasources>

    


      <?xml version="1.0" encoding="UTF-8"?>
<!-- See http://www.jboss.org/community/wiki/Multiple1PC for information about datasource -->
<datasources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:noNamespaceSchemaLocation="http://www.jboss.org/ironjacamar/schema/datasources_1_0.xsd">

  <datasource jndi-name="DerbyDS" pool-name="DerbyDS">
    <connection-url>jdbc:derby:${ironjacamar.home}${/}data${/}derby${/}localDB;create=true</connection-url>
    <driver-class>org.apache.derby.jdbc.EmbeddedDriver</driver-class>
    <pool>
      <min-pool-size>5</min-pool-size>
      <max-pool-size>20</max-pool-size>
    </pool>
    <security>
      <user-name>sa</user-name>
      <password></password>
    </security> 
    <timeout>
      <idle-timeout-minutes>5</idle-timeout-minutes>
    </timeout>
    <statement>
      <track-statements>true</track-statements>
    </statement>
  </datasource>

</datasources>

    


      <?xml version="1.0" encoding="UTF-8"?>

<datasources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:noNamespaceSchemaLocation="http://www.jboss.org/ironjacamar/schema/datasources_1_0.xsd">

  <xa-datasource jndi-name="XADerbyDS" pool-name="XADerbyDS">
    <xa-datasource-property name="DatabaseName">derby/default</xa-datasource-property>
    <xa-datasource-property name="User">sa</xa-datasource-property>
    <xa-datasource-property name="Password"></xa-datasource-property>
    <xa-datasource-property name="CreateDatabase">create</xa-datasource-property>
    <xa-datasource-class>org.apache.derby.jdbc.EmbeddedXADataSource</xa-datasource-class>
     
    <xa-pool>
      <is-same-rm-override>false</is-same-rm-override>
      <!-- Uncomment to enable interleaving <interleaving/> -->
    </xa-pool>
  </xa-datasource>

</datasources>

    


      <?xml version="1.0" encoding="UTF-8"?>
<!-- See http://www.jboss.org/community/wiki/Multiple1PC for information about datasource -->
<datasources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:noNamespaceSchemaLocation="http://www.jboss.org/ironjacamar/schema/datasources_1_0.xsd">
  <datasource jndi-name="OracleDS" pool-name="OracleDS">
    <!--
      Here are a couple of the possible OCI configurations. For more information, 
      see http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/java.920/a96654/toc.htm 
      <connection-url>jdbc:oracle:oci:@youroracle-tns-name</connection-url> or 
      <connection-url>jdbc:oracle:oci:@(description=(address=(host=youroraclehost)(protocol=tcp)(port=1521))(connect_data=(SERVICE_NAME=yourservicename)))</connection-url> 
      Clearly, its better to have TNS set up properly.
    -->
    <connection-url>jdbc:oracle:thin:@youroraclehost:1521:yoursid</connection-url>
    <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
    <security>
      <user-name>x</user-name>
      <password>y</password>
    </security> 
    <validation>
      <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker"></valid-connection-checker>
      <stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker"></stale-connection-checker>
      <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter"></exception-sorter>
    </validation>
  </datasource>

</datasources>

    


      <?xml version="1.0" encoding="UTF-8"?>
<!-- ATTENTION: DO NOT FORGET TO SET Pad=true IN transaction.xml -->
<datasources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:noNamespaceSchemaLocation="http://www.jboss.org/ironjacamar/schema/datasources_1_0.xsd">

  <xa-datasource jndi-name="XAOracleDS" pool-name="XAOracleDS">
    <xa-datasource-property name="URL">jdbc:oracle:oci8:@tc</xa-datasource-property>
    <xa-datasource-property name="User">scott</xa-datasource-property>
    <xa-datasource-property name="Password">tiger</xa-datasource-property>
    <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
    <xa-pool>
      <is-same-rm-override>false</is-same-rm-override>
      <!-- Uncomment to enable interleaving <interleaving/> -->
      <no-tx-separate-pools />
    </xa-pool>
    <validation>
      <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker"></valid-connection-checker>
      <stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker"></stale-connection-checker>
      <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter"></exception-sorter>
    </validation>
  </xa-datasource>

</datasources>

    


      <?xml version="1.0" encoding="UTF-8"?>
<!-- See http://www.jboss.org/community/wiki/Multiple1PC for information about datasource -->
<datasources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:noNamespaceSchemaLocation="http://www.jboss.org/ironjacamard/schema/atasources_1_0.xsd">

  <datasource jndi-name="MSSQLDS" pool-name="MSSQLDS">
    <connection-url>jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=MyDatabase</connection-url>
    <driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
    <security>
      <user-name>x</user-name>
      <password>y</password>
    </security> 
    <validation>
      <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mssql.MSSQLValidConnectionChecker"></valid-connection-checker>
    </validation>
  </datasource>

</datasources>

    


      <?xml version="1.0" encoding="UTF-8"?>

<datasources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:noNamespaceSchemaLocation="http://www.jboss.org/ironjacamar/schema/datasources_1_0.xsd">

  <xa-datasource jndi-name="MSSQLXADS" pool-name="MSSQLXADS">
    <xa-datasource-property name="ServerName">myserver</xa-datasource-property>
    <xa-datasource-property name="DatabaseName">mydatabase</xa-datasource-property>
    <xa-datasource-property name="SelectMethod">cursor</xa-datasource-property>
    <xa-datasource-property name="User">myuser</xa-datasource-property>
    <xa-datasource-property name="Password">mypassword</xa-datasource-property>
    <xa-datasource-class>com.microsoft.sqlserver.jdbc.SQLServerXADataSource</xa-datasource-class>
    <xa-pool>
      <is-same-rm-override>false</is-same-rm-override>
      <!-- Uncomment to enable interleaving <interleaving/> -->
    </xa-pool>
    <validation>
      <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mssql.MSSQLValidConnectionChecker"></valid-connection-checker>
    </validation>
  </xa-datasource>

</datasources>

    


      <?xml version="1.0" encoding="UTF-8"?>
<datasources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:noNamespaceSchemaLocation="http://www.jboss.org/ironjacamar/schema/datasources_1_0.xsd">

  <datasource jndi-name="DB2DS" pool-name="DB2DS">
    <!-- 
      DB2 Universal Driver Note connection URL is in form of
      jdbc:db2://host:port:dbname
         
      Default port for Type 4 driver is 50000
            
      Note, host and port must be specified if using Type 4 driver. And be forewarned, no native
      XA support is provided with Type 4; you must set a DB property calling for Type 2 to get XA
            
      <driver-class>com.ibm.db2.jcc.DB2Driver</driver-class>
      <connection-url>jdbc:db2://[hostname]:[port]/databasename"</connection-url>
            
      Please see http://www-128.ibm.com/developerworks/db2/library/techarticle/dm-0512kokkat/
      or the DB2 JDBC application developers manual.
     -->  
    <connection-url>jdbc:db2:yourdatabase</connection-url>
    <driver-class>COM.ibm.db2.jdbc.app.DB2Driver</driver-class>
    <pool>
      <min-pool-size>0</min-pool-size>
      <max-pool-size>50</max-pool-size>
    </pool>
    <security>
      <user-name>x</user-name>
      <password>y</password>
    </security> 
    <validation>
      <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.db2.DB2ValidConnectionChecker"></valid-connection-checker>
      <stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.db2.DB2StaleConnectionChecker"></stale-connection-checker>
      <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.db2.DB2ExceptionSorter"></exception-sorter>
    </validation>
  </datasource>

</datasources>

    


      <?xml version="1.0" encoding="UTF-8"?>
<datasources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:noNamespaceSchemaLocation="http://www.jboss.org//ironjacamar/schema/datasources_1_0.xsd">
    
  <xa-datasource jndi-name="DB2XADS" pool-name="DB2XADS">
    <xa-datasource-property name="DatabaseName">yout_database_name</xa-datasource-property>
    <xa-datasource-property name="User">your_user</xa-datasource-property>
    <xa-datasource-property name="Password">your_password</xa-datasource-property>
    <xa-datasource-class>COM.ibm.db2.jdbc.DB2XADataSource</xa-datasource-class>
    <xa-pool>
      <is-same-rm-override>false</is-same-rm-override>
      <!-- Uncomment to enable interleaving <interleaving/> -->
    </xa-pool>
    <validation>
      <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.db2.DB2ValidConnectionChecker"></valid-connection-checker>
      <stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.db2.DB2StaleConnectionChecker"></stale-connection-checker>
      <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.db2.DB2ExceptionSorter"></exception-sorter>
    </validation>
  </xa-datasource>
    
</datasources>