You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Marc SCHNEIDER <ms...@sfwan.com> on 2001/10/13 09:17:23 UTC
JDBC ClassCastException (tyrex.jdbc.xa.EnabledDataSource)
Hi,
I'm trying to connect to a mysql database but I get the following error :
java.lang.ClassCastException: tyrex.jdbc.xa.EnabledDataSource
Environnment : Tomcat 4.0 / linux RedHat 7.1 / MySql 3.23
Here is my Java code :
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource) envCtx.lookup("jdbc/test");
Here is the server.xml configuration
<Resource name="jdbc/test" auth="CONTAINER" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/test">
<parameter><name>user</name><value>sa</value></parameter>
<parameter><name>password</name><value></value></parameter>
<parameter><name>driverClassName</name>
<value>org.gjt.mm.mysql.Driver</value></parameter>
<parameter><name>driverName</name>
<value>jdbc:mysql://192.168.0.3:3306/testjouve</value></parameter>
</ResourceParams>
When I use the "classic" method ie with
'Class.forName("org.gjt.mm.mysql.Driver").newInstance();' it works fine !
Any ideas ?
Thanks in advance,
Marc SCHNEIDER.