File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes java.sql.SQLException: No suitable driver found Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "java.sql.SQLException: No suitable driver found" Watch "java.sql.SQLException: No suitable driver found" New topic

java.sql.SQLException: No suitable driver found

Harish Moolchandani

Joined: Mar 12, 2010
Posts: 23
Hello friends, I'm having a problem using Oracle Type4 driver.
I had the following code:

<%@taglib prefix="sql" uri=""%>
<%@page errorPage="/errorpage.jsp"%>

<sql:setDataSource url="jdbc:oracle:thin:@localhost:1521:orcl" driver="oracle.jdbc.OracleDriver" user="gameshop" password="gameshop" var="database" />

<sql:update sql="insert into ORDER_SUBMITTED values(ORDER_SUBMITTED_SEQ.nextval, ?, SYSDATE)" dataSource="${database}" var="order_submitted">
<sql:param value="${userinfo.user_id}"/>

running this produces following error:
Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver found for ${database}"

I've tried these things:
1. The driver requires "ojdbc14.jar" file so I put it in both the lib(i.e in WEB-INF/lib and Tomcat/lib) but nothing solved the problem.
2. I have tried using it on both Tomcat 5.5 and Tomcat 6 but the problem still remains same.
3. I also tried to use the driver "oracle.jdbc.driver.OracleDriver" instead of "oracle.jdbc.OracleDriver" but no improvement.
4. The classpaths for ojdbc14.jar file is also set in Environment variable. One java desktop application is running fine with this driver, but I'm using it first time with JSP's JSTL.

Please help......It's been one day I'm stuck with this problem
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63862

Two things:

  • The JSTL SQL tags are for quick prototyping and should not be used in production code.
  • The error message that you are getting indicates to me that the EL is not being properly evaluated on your page. What happens when you put ${3+4} on your page? Do you see 7?

  • [Asking smart questions] [About Bear] [Books by Bear]
    Aman Goel

    Joined: Jan 14, 2010
    Posts: 15
    Have you put classes12.jar in tomcat library
    eid hazim

    Joined: Jul 24, 2011
    Posts: 6
    i face same this problem ,and the solution ware as the following:

    1- write xml file which contains the JDBC Connection attributes:
    note: the file name should be same webapplication name, and it's case sensitive.

    XML file : Test.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <Context antiJARLocking="true" path="/Test">
    <Resource name="jdbc/TestDB" auth="Container"
    type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver"
    username="user123" password="password123" maxActive="20" maxIdle="10"

    2- put the file name in the \Tomcat 6.0\conf\Catalina\localhost directory.
    3- add the following tags in the web.xml:
    <description>Oracle Datasource example</description>
    4- use the lookup method to get the DataSource as :
    DataSource ds = (DataSource)new InitialContext().lookup( "java:comp/env/jdbc/TestDB" );

    note: the names are case sensitive

    Aditya Kumar Shrivastava

    Joined: Apr 15, 2011
    Posts: 1

    Found the solution.

    The Database drivers must be copied within the: <your_glassfish_domain>/lib/ext folder, NOT just /lib folder (Don't forget the "ext" directory). This worked for me too.

    This is true in all Glassfish versions.

    HTH Eddie Kumar
    I agree. Here's the link:
    subject: java.sql.SQLException: No suitable driver found
    jQuery in Action, 3rd edition