SetUpAPostgreSQLDatasource

    <?xml version="1.0" encoding="UTF-8"?>
    
    <!-- ===================================================================== -->
    <!--                                                                       -->
    <!--  JBoss Server Configuration                                           -->
    <!--                                                                       -->
    <!-- ===================================================================== -->
    
    <!-- $Id: postgres-ds.xml,v 1.3 2004/09/15 14:37:40 loubyansky Exp $ -->
    <!-- ==================================================================== -->
    <!--  Datasource config for Postgres                                      -->
    <!-- ==================================================================== -->
    
    
    <datasources>
      <local-tx-datasource>
        <jndi-name>PostgresDS</jndi-name>
        <connection-url>jdbc:postgresql://[servername]:[port]/[database name]</connection-url>
        <driver-class>org.postgresql.Driver</driver-class>
        <user-name>x</user-name>
        <password>y</password>
            <!-- sql to call when connection is created
            <new-connection-sql>some arbitrary sql</new-connection-sql>
            -->
    
            <!-- sql to call on an existing pooled connection when it is obtained from pool 
            <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
            -->
    
          <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
          <metadata>
             <type-mapping>PostgreSQL 7.2</type-mapping>
          </metadata>
      </local-tx-datasource>
    
    </datasources>
    
    

     

    -


     

    For Postgresql 8.x with XA transactions:

     

    
    <?xml version="1.0" encoding="UTF-8"?>
    
    <!-- ===================================================================== -->
    <!--                                                                       -->
    <!--  JBoss Server Configuration                                           -->
    <!--                                                                       -->
    <!-- ===================================================================== -->
    <!--  Datasource config for Postgres 8.x *** with XA transactions ***      -->
    <!-- ====================================================================  -->
    
    <datasources>
       <xa-datasource>
         <jndi-name>PostgresDS</jndi-name>
    
         <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
         <xa-datasource-property name="ServerName">[servername]</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">[username]</xa-datasource-property>
         <xa-datasource-property name="Password">[password]</xa-datasource-property>
    
         <track-connection-by-tx></track-connection-by-tx>
       </xa-datasource>
    </datasources>