• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

DataSource : No suitable driver...?????

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello folks, why iam getting this exception ?
Please this is very urgent for my project help me.
i will be available throughout both in mail and
in watching response in this forums.
Here, iam working on the simple servlet application
to get connection from (tomcat4.0.4 tyrex) connection pool
using datasource. Iam using thin driver for the oracle.
and the jvm is jdk1.3.1 version on windows2000.
my previous connection using DriverManager was:
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
connection=DriverManager.getConnection("jdbc racle:thin:@ABCD:1521:MYSID","ONE","TWO");
now i want to use connection using DataSource.
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource)envCtx.lookup("jdbc/EmpDB");
Connection conn = ds.getConnection();

1. my servlet class file was in
tomcat\webapps\root\web-inf\classes
2. my thindriver's classes12.jar was in
tomcat\common\lib
(i renamed classes12.zip to classes12.jar)
I dont know exactly which <context> should be commented
and which one uncommented in server.xml file, infact
iam unfamiliar with xml configurations.
so if possible correct my server.xml and send me.
here is my server.xml,web.xml for ur reference.
my server.xml content is:
-------------------------
<Server port="8005" shutdown="SHUTDOWN" debug="0">
<Service name="Tomcat-Standalone">
<Connector className="org.apache.catalina.connector.http.HttpConnector"
port="8080" minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="8443"
acceptCount="10" debug="0" connectionTimeout="60000"/>
<Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
port="8009" minProcessors="5" maxProcessors="75"
acceptCount="10" debug="0"/>
<Engine name="Standalone" defaultHost="localhost" debug="0">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="catalina_log." suffix=".txt"
timestamp="true"/>
<Realm className="org.apache.catalina.realm.MemoryRealm" />
<Host name="localhost" debug="0" appBase="webapps" unpackWARs="true">
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="localhost_access_log." suffix=".txt"
pattern="common"/>
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="localhost_log." suffix=".txt"
timestamp="true"/>
<!-- Tomcat Root Context -->
<Context path="" docBase="ROOT" debug="0">
<!-- XXXX MY MODIFICATIONS HERE XXXxx -->
<Resource name="jdbc/EmpDB" auth="SERVLET" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/EmpDB">
<parameter>
<name>user</name><value>ONE</value>
</parameter>
<parameter>
<name>password</name><value>TWO</value>
</parameter>
<parameter>
<name>driverClassName</name><value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>url</name><value>jdbc racle:thin:@ABCD:1521/MYSID</value>
</parameter>
<parameter><name>maxActive</name><value>32</value></parameter>
<parameter><name>maxIdle</name><value>10</value></parameter>
</ResourceParams>
<!-- XXXXXXX MY MODIFICATIONS ENDS HERE XXXXXXXXXX -->
<!-- Tomcat Manager Context -->
<!-- <Context path="/manager" docBase="manager" debug="0" privileged="true"/> -->
<!-- Tomcat Examples Context
<Context path="/examples" docBase="examples" debug="0" reloadable="true" crossContext="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="localhost_examples_log." suffix=".txt"
timestamp="true"/>
<Ejb name="ejb/EmplRecord" type="Entity"
home="com.wombat.empl.EmployeeRecordHome"
remote="com.wombat.empl.EmployeeRecord"/>
<Environment name="maxExemptions" type="java.lang.Integer"
value="15"/>
<Parameter name="context.param.name" value="context.param.value"
override="false"/>
<Resource name="mail/Session" auth="Container"
type="javax.mail.Session"/>
<ResourceParams name="mail/Session">
<parameter>
<name>mail.smtp.host</name>
<value>localhost</value>
</parameter>
</ResourceParams>
-->
</Context>
</Host>
</Engine>
</Service>
<!-- Define an Apache-Connector Service -->
<Service name="Tomcat-Apache">
<Connector className="org.apache.catalina.connector.warp.WarpConnector"
port="8008" minProcessors="5" maxProcessors="75"
enableLookups="true" appBase="webapps"
acceptCount="10" debug="0"/>
<!-- Replace "localhost" with what your Apache "ServerName" is set to -->
<Engine className="org.apache.catalina.connector.warp.WarpEngine"
name="Apache" debug="0">
<!-- Global logger unless overridden at lower levels -->
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="apache_log." suffix=".txt"
timestamp="true"/>
<!-- Because this Realm is here, an instance will be shared globally -->
<Realm className="org.apache.catalina.realm.MemoryRealm" />
</Engine>
</Service>
</Server>

my web.xml is:
--------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>DataSourceServlet</servlet-name>
<servlet-class>DataSourceServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>DataSourceServlet</servlet-name>
<url-pattern> /DataSourceServlet </url-pattern>
</servlet-mapping>
<resource-ref>
<description> Resource reference to a factory for java.sql.Connection
instances that may be used for talking to a particular
database that is configured in the server.xml file.
</description>
<res-ref-name>jdbc/EmpDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth> Container</res-auth>
</resource-ref>
</web-app>

The Exception iam getting when i run the application
on browser url as "http://localhost:8080/DataSourceServlet"
is:
java.sql.SQLException: No suitable driver

thanx.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!