• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java.sql.SQLException: No suitable driver found

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello friends, I'm having a problem using Oracle Type4 driver.
I had the following code:

<%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<%@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}"/>
</sql:update>


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
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?

  •  
    Greenhorn
    Posts: 15
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Have you put classes12.jar in tomcat library
     
    Greenhorn
    Posts: 6
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Dears,
    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"
    url="jdbc:oracle:thin:@localhost:1521:testdb"
    username="user123" password="password123" maxActive="20" maxIdle="10"
    maxWait="-1"/>
    </Context>

    2- put the file name in the \Tomcat 6.0\conf\Catalina\localhost directory.
    3- add the following tags in the web.xml:
    <resource-ref>
    <description>Oracle Datasource example</description>
    <res-ref-name>jdbc/TestDB</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    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

    Regards.
     
    Greenhorn
    Posts: 1
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi,

    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
     
    Everybody's invited. Even this tiny ad:
    a bit of art, as a gift, that will fit in a stocking
    https://gardener-gift.com
    reply
      Bookmark Topic Watch Topic
    • New Topic