tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Terje Hopsø <tehos...@online.no>
Subject RE: Database connection "No suitable driver"?
Date Mon, 02 Jun 2003 22:12:19 GMT
It is there. 

Tomcat version is 4.1.24.

- Terje


-----Original Message-----
From: John Moore [mailto:JohnMoore@PDSI-Software.COM] 
Sent: 3. juni 2003 00:05
To: 'Tomcat Users List'
Subject: RE: Database connection "No suitable driver"?




We also put jdbc2_0-stdext.jar in the common/lib directy.   

-----Original Message-----
From: Terje Hopsø [mailto:tehosubs@online.no]
Sent: Monday, June 02, 2003 2:54 PM
To: 'Tomcat Users List'
Subject: Database connection "No suitable driver"?


Hello,
 
I have to ask you once again. I have tried to get a connection to my
Sybaseserver. I get "no suitable driver" when trying to connect. Do anyone
have a suggestion on what is wrong. Sybase driver file jconn2.jar is placed
under $CATALINA/common/lib.
 
It is a long mail but I hope anyone will look at it.
 
- Terje
 
 
    org.apache.jasper.JasperException: Unable to get connection, DataSource
invalid: "No suitable driver"
    at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2
54)
    at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
    .....
 
I have an example that is working:
...
<%@ page language="java" %>
<%@ page import="java.lang.*" %>
<%@ page import="java.util.*" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
 <body>
  <sql:setDataSource var="ex" scope="application"
   driver="com.sybase.jdbc2.jdbc.SybDriver"
   url="jdbc:sybase:Tds:xxxxx:4444"
   user="uuuu"
   password="pwdpwd"
  />
  <sql:query var="rader" dataSource="${ex}" >
   select Initialer 
   from Skytter
  </sql:query>
 
Liste :<br>
  <c:forEach items="${rader.rows}" var="rad">
   <c:out value="${rad.Initialer}" /><br>
  </c:forEach>
 </body>
</html>
-----------------------------------------------------
And one that is not working. 
.....
<%@ page language="java" %>
<%@ page import="java.lang.*" %>
<%@ page import="java.util.*" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
 <body>
  <sql:setDataSource var="ex" scope="application"
   dataSource="javax.sql.DataSource"
  />
  <sql:query var="rader" dataSource="${ex}">
   select Initialer 
   from Skytter
  </sql:query>
  <c:forEach items="${rader.rows}" var="rad">
   <c:out value="${rad.Initialer}" /><br>
  </c:forEach>
-----------------------------------------------------------
 
My web.xml is lik this.
 
 <context-param>
  <param-name>
   javax.sql.DataSource
  </param-name>
  <param-value>
  jdbc:sybase:Tds:xxxxxx:4444,com.sybase.jdbc2.jdbc.SybDriver,uuuu,pwdpwd
  </param-value>
 </context-param>
-------------- OR LIKE THIS
 <resource-ref>
  <description>DB Connection</description>
  <res-ref-name>jdbc/resDB</res-ref-name>
  <res-type>javax.sql.DataSource</res-type>
  <res-auth>Container</res-auth>
 </resource-ref>
--------------------------------------------------
server.xml
 
        <Context className="org.apache.catalina.core.StandardContext"
cachingAllowed="true"
charsetMapperClass="org.apache.catalina.util.CharsetMapper" cookies="true"
crossContext="false" debug="0" displayName="dbtest"
docBase="c:\usr\utvikl\dbtest"
mapperClass="org.apache.catalina.core.StandardContextMapper" path="/dbtest"
privileged="false" reloadable="true" swallowOutput="false" useNaming="false"
wrapperClass="org.apache.catalina.core.StandardWrapper">
          <Resource name="jdbc/resDB" scope="Shareable"
type="javax.sql.DataSource"/>
          <ResourceParams name="jdbc/resDB">
            <parameter>
              <name>validationQuery</name>
              <value></value>
            </parameter>
            <parameter>
              <name>maxWait</name>
              <value>5000</value>
            </parameter>
            <parameter>
              <name>maxActive</name>
              <value>4</value>
            </parameter>
            <parameter>
              <name>password</name>
              <value>pwdpwd</value>
            </parameter>
            <parameter>
              <name>url</name>
              <value>jdbc:sybase:Tds:xxxxxxxx:4444</value>
            </parameter>
            <parameter>
              <name>driverClassName</name>
              <value>com.sybase.jdbc2.jdbc.SybDriver</value>
            </parameter>
            <parameter>
              <name>maxIdle</name>
              <value>2</value>
            </parameter>
            <parameter>
              <name>username</name>
              <value>uuuu</value>
            </parameter>
          </ResourceParams>
        </Context>
--------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message