geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jack Wang <pipa...@yahoo.com>
Subject Re: Tomcat MySQL XA support
Date Thu, 09 Feb 2006 03:59:54 GMT
--- lichtner <lichtner@bway.net>写道:
> 
> Is it possible that the data source also has to be listed in your web.xml?
> 

Yes, I have resource-ref defined in web.xml. But the XADataSource is null, why ?


 <resource-ref>
    <res-ref-name>jdbc/myXADB</res-ref-name>
    <res-type>javax.sql.XADataSource</res-type>
    <res-auth>Container</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
 </resource-ref>



> On Thu, 9 Feb 2006, Jack Wang wrote:
> > --- "Christopher G. Stach II" <cgs@ldsys.net>写道:
> > > Jack Wang wrote:
> > > > I can get connect from Resource configured in tomcat with type="javax.sql.DataSource".
But
> the
> > > > project needs the XADataSource, so I configure the XADataSource in tomcat's
server.xml
> with
> > > You need to use mysql-connector-java-5.0.0-beta's
> > > com.mysql.jdbc.jdbc2.optional.MysqlXADataSource with a MySQL 5.0 server,
> > > or the far less desirable XAPool for fake XA.
> > >
> >
> > --- "Christopher G. Stach II" <cgs@ldsys.net>写道:
> > > You need to use mysql-connector-java-5.0.0-beta's
> > > com.mysql.jdbc.jdbc2.optional.MysqlXADataSource with a MySQL 5.0 server,
> > > or the far less desirable XAPool for fake XA.
> > >
> >
> > I have used mysql-connector-java-5.0.0-beta, but I still have the null XADataSource
xaDs from
> the
> > java action.
> > Here is the server.xml in tomcat:
> >
> > -------------------------------------------------
> > <Resource name="jdbc/myXADB" auth="Container"
> >   type="javax.sql.XADataSource"
> >   factory="com.mysql.jdbc.jdbc2.optional.MysqlDataSourceFactory"
> >   driverClassName="com.mysql.jdbc.Driver"
> >   user="root"
> >   password="password"
> >   url="jdbc:mysql://localhost/test?useUnicode=true&amp;characterEncoding=gbk"
> > />
> > -------------------------------------------------
> >
> > And the is my action:
> >
> > -------------------------------------------------
> > Context ctx = new InitialContext();
> > XADataSource xaDs = (XADataSource)ctx.lookup("java:comp/env/jdbc/myXADB");
> > // Here get the null xaDs, Oops !!
> > -------------------------------------------------
> >
> > My environment is :
> >  JDK 1.5
> >  Tomcat 5.5
> >  MySQL: 5.0.18-win32
> >  Connector/J 5.0 beta
> >
> > I have checked mysql-connector-java-5.0.0-beta changes. The 11-04-05 - Version 5.0.0-beta
> > - XADataSource implemented (ported from 3.2 branch which won't be
> >   released as a product).
> >   Use "com.mysql.jdbc.jdbc2.optional.MysqlXADataSource" as your datasource
> >   class name in your application server to utilize XA transactions
> >   in MySQL-5.0.10 and newer.
> >
> > So, what's the wrong ? Please help. Thanks.
> >
> >

Wang Jun


		
____________________________________________________


Mime
View raw message