Thread: Data Source
Hi All, I'm doing a ejb tutorial that works with a server called Blazix. I now have to configure a datasource. Blazix wants the driver to implement javax.transaction.xa.XAResource From searching the archives it seems that what is in pgjdbc2.jar does not. Is that correct? I'm using PostgreSQL 7.2.1. Now I'm supposed to write a wrapper class that implements a certain interfce that looks like this: public interface JdbcResourceFactory { javax.sql.XADataSource getXADataSource( String jndi, Hashtable props ) throws SQLException; javax.sql.ConnectionPoolDataSource getConnectionPoolDataSource( String jndi, Hashtable props ) throws SQLException; javax.sql.DataSource getDataSource( String jndi, Hashtable props ) throws SQLException; String getDriverManagerClass( String jndi, Hashtable props ) throws SQLException; String getUrl( String jndi, Hashtable props ) throws SQLException; } I'm left open-mouthed in the starting blocks. Is there anybody out there with an idea what to do? Thanks very much. -- Chris Malan malan2000@optusnet.com.au Home Page: http://members.optusnet.com.au/~malan2000
Chris, The XADataSource is not supported by the driver because postgres doesn't support two phase commits. DAve On Wed, 2003-03-05 at 23:02, Chris Malan wrote: > Hi All, > > I'm doing a ejb tutorial that works with a server called Blazix. > > I now have to configure a datasource. Blazix wants the driver to implement > javax.transaction.xa.XAResource > > >From searching the archives it seems that what is in pgjdbc2.jar does not. Is > that correct? I'm using PostgreSQL 7.2.1. > > Now I'm supposed to write a wrapper class that implements a certain interfce > that looks like this: > > public interface JdbcResourceFactory > { > javax.sql.XADataSource getXADataSource( > String jndi, > Hashtable props ) > throws SQLException; > javax.sql.ConnectionPoolDataSource getConnectionPoolDataSource( > String jndi, > Hashtable props ) > throws SQLException; > javax.sql.DataSource getDataSource( > String jndi, > Hashtable props ) > throws SQLException; > String getDriverManagerClass( String jndi, Hashtable props ) > throws SQLException; > String getUrl( String jndi, Hashtable props ) throws SQLException; > } > > I'm left open-mouthed in the starting blocks. > > Is there anybody out there with an idea what to do? > > Thanks very much. -- Dave Cramer <Dave@micro-automation.net>
On 6 Mar 2003, Dave Cramer wrote: > Chris, > > The XADataSource is not supported by the driver because postgres doesn't > support two phase commits. That said, it's not unusual to see a "fake" XADataSource impleemntation that wraps a non-XA DataSource and works fine as long as 1) It's the only non-real XADataSource AND it's invoked last in the prepare phase of the transaction - or - 2) No resource ever fails to prepare That's pretty chancy, but it beats nothing at all. You can implement one of these yourself with some research into the JDBC2 optional package, or take it from one of the open-source app servers or something. Aaron