www.ironjacamar.orgCommunity Documentation

Appendix C. Datasources

Table of Contents

C.1. PosgreSQL
C.2. PosgreSQL XA
C.3. MySQL
C.4. MySQL XA
C.5. H2
C.6. H2 XA
C.7. Derby
C.8. Derby XA
C.9. Oracle
C.10. Oracle XA
C.11. Microsoft SQLServer
C.12. Microsoft SQLServer XA
C.13. IBM DB2
C.14. IBM DB2 XA

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



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

  <datasource jndi-name="java:/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.ironjacamar.org/schema/datasources_1_0.xsd">

  <xa-datasource jndi-name="java:/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-class>org.postgresql.xa.PGXADataSource</xa-datasource-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>
  </xa-datasource>

</datasources>

    


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

  <datasource jndi-name="java:/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.ironjacamar.org/schema/datasources_1_0.xsd">

  <xa-datasource jndi-name="java:/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-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-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>
  </xa-datasource>

</datasources>

    


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

<datasources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:noNamespaceSchemaLocation="http://www.ironjacamar.org/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.ironjacamar.org/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"?>
<datasources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:noNamespaceSchemaLocation="http://www.ironjacamar.org/schema/datasources_1_0.xsd">

  <datasource jndi-name="java:/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>
    <security>
      <user-name>sa</user-name>
      <password></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.ironjacamar.org/schema/datasources_1_0.xsd">

  <xa-datasource jndi-name="java:/XADerbyDS" pool-name="XADerbyDS">
    <xa-datasource-property name="DatabaseName">derby/default</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>
    <security>
      <user-name>sa</user-name>
      <password></password>
    </security> 
  </xa-datasource>

</datasources>

    


      <?xml version="1.0" encoding="UTF-8"?>
<datasources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:noNamespaceSchemaLocation="http://www.ironjacamar.org/schema/datasources_1_0.xsd">
  <datasource jndi-name="java:/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>
    <!-- you don't need this but it helps DBAs identify the application associated with a connection -->
    <connection-property name="v$session.program">IronJacamar</connection-property>
    <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.ironjacamar.org/schema/datasources_1_0.xsd">

  <xa-datasource jndi-name="java:/XAOracleDS" pool-name="XAOracleDS">
    <xa-datasource-property name="URL">jdbc:oracle:oci8:@tc</xa-datasource-property>
    <!-- you don't need this but it helps DBAs identify the application associated with a connection -->
    <xa-datasource-property name="connectionProperties">v$session.program=IronJacamar</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>
    <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>
  </xa-datasource>

</datasources>

    


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

  <datasource jndi-name="java:/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.ironjacamar.org/schema/datasources_1_0.xsd">

  <xa-datasource jndi-name="java:/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-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>
    <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>
  </xa-datasource>

</datasources>

    


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

  <datasource jndi-name="java:/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>
    <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.ironjacamar.org/doc/schema/datasources_1_0.xsd">
    
  <xa-datasource jndi-name="java:/DB2XADS" pool-name="DB2XADS">
    <xa-datasource-property name="DatabaseName">your_database_name</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>
    <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>
    <recovery>
      <recover-plugin class-name="org.jboss.jca.core.recovery.ConfigurableRecoveryPlugin">
        <config-property name="EnableIsValid">false</config-property>
        <config-property name="IsValidOverride">false</config-property>
        <config-property name="EnableClose">false</config-property>
      </recover-plugin>
    </recovery>
  </xa-datasource>
    
</datasources>