Here is my server.xml entry (with substitutions):
<DefaultContext>
<Resource name="jdbc/sybase" auth="Container" type="javax.sql.DataSource" />
<ResourceParams name="jdbc/sybase">
<parameter>
<name>user</name>
<value>username</value>
</parameter>
<parameter>
<name>password</name>
<value>qwerty</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.sybase.jdbc2.jdbc.SybDriver</value>
</parameter>
<parameter>
<name>driverName</name>
<value>jdbc:sybase:Tds:host:port/db</value>
</parameter>
</ResourceParams>
</DefaultContext>
Here is the JSP scriplet I am using to test it:
<%
try {
Context ctx = new InitialContext();
Context envCtx = (Context) ctx.lookup("java:comp/env");
DataSource ds = (DataSource)envCtx.lookup("jdbc/sybase");
Connection con = ds.getConnection();
con.close();
} catch(Exception ex) {
out.println(ex); // print exception
}
%>
When I execute this page, I get this:
javax.naming.NamingException: Exception creating DataSource: tyrex/jdbc/xa/EnabledDataSource
In my Tomcat console I get a stack trace that starts with:
TyrexDataSourceFactory: Cannot create DataSource, Exception
java.lang.NoClassDefFoundError: tyrex/jdbc/xa/EnabledDataSource
-
Having trouble with DataSource in Tomcat 4.0.4 (0 messages)
- Posted by: joseph yi
- Posted on: June 28 2002 16:40 EDT