What is the release of the JDBC driver that you are using? The "class
name" has changed over time, because JDBC has changed over time...
For instance, with JConnect 5.5 the library *jconn2.jar* defines
*com.sybase.jdbc2.jdbc.SybDriver* (2, not 3)
Użytkownik "Steve Whatmore" <steven....@lynxdev.com> napisał w wiadomości news:46f80186@forums-1-dub...
"Remigiusz Cieslak (EMATIQUE)" <emat...@ematique.com> wrote in message news:46f8c946$1@forums-1-dub...
"Steve Whatmore" <steven....@lynxdev.com> wrote in message news:46f90d79$1@forums-1-dub...
Here is an old post I had prepared long ago. I am not certain if it
still is workable:
"I have posted this earlier in the jconnect50 group. I will post
again here.
"I had the same kinds of problems as the poster with setting up the
DataSource. I took your advice and setup the dbcp connection pool for
Sybase. Here is my settings on 4.1.18.
<!-- Sybase Examples Context -->
<Context path="/SybTest" docBase="sybtest" debug="5"
reloadable="true" crossContext="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="localhost_SybTest.log." suffix=".txt"
timestamp="true"/>
<Resource name="jdbc/pubs2"
auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/pubs2">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>10</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>5</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>10000</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.sybase.jdbc2.jdbc.SybDriver</value>
*** delete this, you can use jdbc3 if you are using the
jconn3.jar vs the jconn2.jar *******
</parameter>
<parameter>
<name>url</name>
<value>jdbc:sybase:Tds:powerjay:3439</value>
</parameter>
<parameter>
<name>username</name>
<value>scott</value>
</parameter>
<parameter>
<name>password</name>
<value>scottpw</value>
</parameter>
</ResourceParams>
</Context>
"
>This is a multi-part message in MIME format.
>
>------=_NextPart_000_0021_01C7FEB7.12FA6AE0
>Content-Type: text/plain;
> charset="iso-8859-1"
>Content-Transfer-Encoding: quoted-printable
>
>Good afternoon,
>
>I am having problems in connecting using the BasicDataSource from Tomcat =
>/ Apahce when configuring it through the web.xml file and the =
>context.xml file.
>
>Here are the excerpts from web.xml
>
> <!-- Connection Pooling Resource Definition -->
> <resource-ref>
> <description>Data Source Connection Pool</description>
> <res-ref-name>jdbc/sybase</res-ref-name>
> <res-type>javax.sql.DataSource</res-type>
> <res-auth>Application</res-auth>
> </resource-ref>
>
>and context.xml
>
> <Resource
> name=3D"jdbc/sybase"
> auth=3D"Application"
> factory=3D"org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
> type=3D"javax.sql.DataSource"
> driverClassName=3D"com.sybase.jdbc3.jdbc.SybDriver"
> url=3D"jdbc:sybase:Tds:JAVASOURCE:5000/nbcn"
> username=3D"dkim"
> password=3D"password"
> minIdle=3D"5"
> maxActive=3D"50"
> maxWait=3D"5000"
> defaultAutoCommit=3D"true"
> defaultReadOnly=3D"false"
> validationQuery=3D""
> testWhileIdle=3D"false"
> testOnBorrow=3D"false"
> testOnReturn=3D"false" =20
> timeBetweenEvictionRunsMillis=3D"300000"
> minEvictableIdleTimeMillis=3D"240000"
> removeAbandoned=3D"true"
> removeAbandonedTimeout=3D"300"
> logAbandoned=3D"true"
> />
>
>I am receiving the following error:
> =20
>org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver =
>class 'com.sybase.jdbc3.jdbc.SybDriver'
> at =
>org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSou=
>rce.java:766)
> at =
>org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource=
>.java:540)
> at com.lynxdev.db.DataSource.getConnection(DataSource.java:97)
> at com.lynxdev.db.DataStoreDAO.getConnection(DataStoreDAO.java:36)
> at com.lynxdev.db.DataStoreDAO.getUsers(DataStoreDAO.java:75)
> at com.lynxdev.action.UserAction.getUserTable(UserAction.java:25)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at =
>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java=
>:39)
> at =
>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorI=
>mpl.java:25)
>...
>Caused by: java.lang.ClassNotFoundException: =
>com.sybase.jdbc3.jdbc.SybDriver
> at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:169)
> at =
>org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSou=
>rce.java:760)
>
>However, when I explicity load the class using something like:
>
> // Sybase jdbc driver : com.sybase.jdbc3.jdbc.SybDriver
> Class.forName("com.sybase.jdbc3.jdbc.SybDriver");
> conn =3D =
>DriverManager.getConnection("jdbc:sybase:Tds:JAVASOURCE:5000/nbcn", =
>"user", "assword");
>
>everything seems to work fine.
>
>Any ideas=20
>
>Thanks in advance.
>
>Whatty
>------=_NextPart_000_0021_01C7FEB7.12FA6AE0
>Content-Type: text/html;
> charset="iso-8859-1"
>Content-Transfer-Encoding: quoted-printable
>
><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
><HTML><HEAD>
><META http-equiv=3DContent-Type content=3D"text/html; =
>charset=3Diso-8859-1">
><META content=3D"MSHTML 6.00.6000.16525" name=3DGENERATOR>
><STYLE></STYLE>
></HEAD>
><BODY>
><DIV>
><DIV><FONT face=3DArial size=3D2>Good afternoon,</FONT></DIV>
><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
><DIV><FONT face=3DArial size=3D2>I am having problems in connecting =
>using the=20
>BasicDataSource from Tomcat / Apahce when configuring it through the =
>web.xml=20
>file and the context.xml file.</FONT></DIV>
><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
><DIV><FONT face=3DArial size=3D2>Here are the excerpts from =
>web.xml</FONT></DIV>
><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
><DIV><FONT face=3DArial size=3D2> <!-- Connection =
>Pooling=20
>Resource Definition --></FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2> =20
><resource-ref></FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2> =
> =20
><description>Data Source Connection =
>Pool</description></FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2> =
> =20
><res-ref-name>jdbc/sybase</res-ref-name></FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2> =
> =20
><res-type>javax.sql.DataSource</res-type></FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2> =
> =20
><res-auth>Application</res-auth></FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2> =20
></resource-ref></FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2></FONT> </DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2>and =
>context.xml</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2></FONT> </DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2> =20
><Resource</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2> =
> =20
>name=3D"jdbc/sybase"</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial=20
>size=3D2> =20
>auth=3D"Application"</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial=20
>size=3D2> =20
>factory=3D"org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"</FONT></DI=
>V>
><DIV align=3Dleft><FONT face=3DArial=20
>size=3D2> =20
>type=3D"javax.sql.DataSource"</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial=20
>size=3D2> =20
>driverClassName=3D"com.sybase.jdbc3.jdbc.SybDriver"</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial=20
>size=3D2> =20
>url=3D"jdbc:sybase:Tds:JAVASOURCE:5000/nbcn"</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial=20
>size=3D2> =
>username=3D"dkim"</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial=20
>size=3D2> =20
>password=3D"password"</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial=20
>size=3D2> =
>minIdle=3D"5"</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial=20
>size=3D2> =
>maxActive=3D"50"</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial=20
>size=3D2> =
>maxWait=3D"5000"</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial=20
>size=3D2> =20
>defaultAutoCommit=3D"true"</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial=20
>size=3D2> =20
>defaultReadOnly=3D"false"</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial=20
>size=3D2> =20
>validationQuery=3D""</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial=20
>size=3D2> =20
>testWhileIdle=3D"false"</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial=20
>size=3D2> =20
>testOnBorrow=3D"false"</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial=20
>size=3D2> =20
>testOnReturn=3D"false" =
></FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial=20
>size=3D2> =20
>timeBetweenEvictionRunsMillis=3D"300000"</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial=20
>size=3D2> =20
>minEvictableIdleTimeMillis=3D"240000"</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial=20
>size=3D2> =20
>removeAbandoned=3D"true"</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial=20
>size=3D2> =20
>removeAbandonedTimeout=3D"300"</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial=20
>size=3D2> =20
>logAbandoned=3D"true"</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2> =
>/></FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2></FONT> </DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2>I am receiving the =
>following=20
>error:</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2> =
></FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial=20
>size=3D2>org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load =
>JDBC driver=20
>class 'com.sybase.jdbc3.jdbc.SybDriver'</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2> at=20
>org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSou=
>rce.java:766)</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2> at=20
>org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource=
>.java:540)</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2> at=20
>com.lynxdev.db.DataSource.getConnection(DataSource.java:97)</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2> at=20
>com.lynxdev.db.DataStoreDAO.getConnection(DataStoreDAO.java:36)</FONT></D=
>IV>
><DIV align=3Dleft><FONT face=3DArial size=3D2> at=20
>com.lynxdev.db.DataStoreDAO.getUsers(DataStoreDAO.java:75)</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2> at=20
>com.lynxdev.action.UserAction.getUserTable(UserAction.java:25)</FONT></DI=
>V>
><DIV align=3Dleft><FONT face=3DArial size=3D2> at=20
>sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2> at=20
>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java=
>:39)</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2> at=20
>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorI=
>mpl.java:25)</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2>...</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2>Caused by:=20
>java.lang.ClassNotFoundException: =
>com.sybase.jdbc3.jdbc.SybDriver</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2> at=20
>java.net.URLClassLoader$1.run(URLClassLoader.java:200)</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2> at=20
>java.security.AccessController.doPrivileged(Native Method)</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2> at=20
>java.net.URLClassLoader.findClass(URLClassLoader.java:188)</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2> at=20
>java.lang.ClassLoader.loadClass(ClassLoader.java:306)</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2> at=20
>java.lang.ClassLoader.loadClass(ClassLoader.java:251)</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2> at=20
>java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)</FONT></DIV=
>>
><DIV align=3Dleft><FONT face=3DArial size=3D2> at=20
>java.lang.Class.forName0(Native Method)</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2> at=20
>java.lang.Class.forName(Class.java:169)</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2> at=20
>org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSou=
>rce.java:760)</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2></FONT> </DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2>However, when I =
>explicity load the=20
>class using something like:</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2></FONT> </DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2> // =
>Sybase jdbc driver=20
>: com.sybase.jdbc3.jdbc.SybDriver</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2> =20
>Class.forName("com.sybase.jdbc3.jdbc.SybDriver");</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2> conn =
>=3D=20
>DriverManager.getConnection("jdbc:sybase:Tds:JAVASOURCE:5000/nbcn", =
>"user",=20
>"assword");</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2></FONT> </DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2>everything seems to work=20
>fine.</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2></FONT> </DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2>Any ideas </FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2></FONT> </DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2>Thanks in =
>advance.</FONT></DIV>
><DIV align=3Dleft><FONT face=3DArial size=3D2></FONT> </DIV>
><DIV align=3Dleft><FONT face=3DArial =
>size=3D2>Whatty</FONT></DIV></DIV></BODY></HTML>
>
>------=_NextPart_000_0021_01C7FEB7.12FA6AE0--
>
"Simon Ogden" <sog...@sybase.com> wrote in message news:46f91311@forums-1-dub...