[jboss-user] [Beginners Corner] - Re: How to configure XA Datasource for JBoss 4.2.2 and Postg

allapetrova do-not-reply at jboss.com
Wed Jan 28 15:49:37 EST 2009


Ok, I figured it out and documenting for those who come later. Below is an example of XA Datasource configuration for Postgres: postgres-xa-ds.xml
Also you need to have Postgress .jar with org.postgresql.xa.PGXADataSource in your JBoss classpath. I am using postgresql-8.3-604.jdbc3.jar. I put it in my application lib directory.

The database I am connecting to is legacy version 7.2 So I am not sure if I would have any problems with it, but it is a separate issue.

<datasources>
  |   <xa-datasource>
  |     <jndi-name>DefaultDS</jndi-name>
  |      <track-connection-by-tx/>
  |     <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class> 
  |     <xa-datasource-property name="ServerName">MyTestDBServer</xa-datasource-property>
  |     <xa-datasource-property name="DatabaseName">MyDBName</xa-datasource-property>
  |     <user-name>X</user-name>
  |     <password>Y</password>
  |     <!-- sql to call when connection is created -->
  |     <new-connection-sql>select count(*) from pd_status</new-connection-sql>
  |     
  |     <!-- sql to call on an existing pooled connection when it is obtained from pool  -->
  |     <check-valid-connection-sql>select count(*) from pd_status</check-valid-connection-sql>
  |  
  |     <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
  |     <metadata>
  |      <type-mapping>PostgreSQL 7.2</type-mapping>
  |     </metadata>
  |   </xa-datasource>
  | 
  | .....
  | 
  | </datasources>

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4205389#4205389

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4205389



More information about the jboss-user mailing list