• 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

DBCP => Cannot create JDBC driver of class '' for connect URL 'null'

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I use dbcp with Tomcat5.0, Oracle9i jdbc driver (classes12.jar).

I put classes12.jar in $CATALINA_HOME/common/lib
----------------------------------------------------------------
server.xml

<GlobalNamingResources>
<Resource name="jdbc/myoracle" auth="Container"
type="javax.sql.DataSource"/>

<ResourceParams name="jdbc/myoracle">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc racle:thin:myschema@127.0.0.1:1521:mysid</value>
</parameter>
<parameter>
<name>username</name>
<value>scott</value>
</parameter>
<parameter>
<name>password</name>
<value>tiger</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>20</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>10</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>-1</value>
</parameter>
</ResourceParams>

</GlobalNamingResources>
--------------------------------------------------------
web.xml

<resource-ref>
<description>Oracle Datasource example</description>
<res-ref-name>jdbc/myoracle</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
-------------------------------------------------
my Code

Context initContext = new InitialContext();
Context envContext = (Context)initContext.lookup("java:/comp/env");
DataSource ds = (DataSource)envContext.lookup("jdbc/myoracle");
Connection conn = ds.getConnection();
---------------------------------------------------

but this error appeared:

Cannot create JDBC driver of class '' for connect URL 'null'

What is wrong?

Regards
soli

 
Ranch Hand
Posts: 1211
Mac IntelliJ IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does it work if you try to get a connection using the same Driver and connection String from a simple JDBC program using DriverManager?

My suggestion...check that 'oracle.jdbc.driver.OracleDriver' is actually present in classes12.jar, and there is no spelling mistake. Also, you can try Oracle JDBC classes for Java 1.4 and later: It is called ojdbc.jar instead of classes12.jar.

HTH
 
Solmaz Anvar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sonny Gill:
Does it work if you try to get a connection using the same Driver and connection String from a simple JDBC program using DriverManager?

My suggestion...check that 'oracle.jdbc.driver.OracleDriver' is actually present in classes12.jar, and there is no spelling mistake. Also, you can try Oracle JDBC classes for Java 1.4 and later: It is called ojdbc.jar instead of classes12.jar.

HTH



I tried this connection string with DriverManager.It work fine.
I use ojdbc.jar instead of classess12.jar and put <Resource> tag in <DefaultContext> but i have same error.

Help me
Thanks
Regards Soli


[ August 20, 2005: Message edited by: Solmaz Anvar ]
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Solmaz Anvar:


I tried this connection string with DriverManager.It work fine.
I use ojdbc.jar instead of classess12.jar and put <Resource> tag in <DefaultContext> but i have same error.

Help me
Thanks
Regards Soli



[ August 20, 2005: Message edited by: Solmaz Anvar ]




1) In the Context configuration, please change the property username to user.
2) Use oracle.jdbc.pool.OracleDataSourceFactory instead of org.apache.commons.dbcp.BasicDataSourceFactory

Here is the altered snippet....

<ResourceParams name="jdbc/myoracle">
<parameter>
<name>factory</name>
<value>oracle.jdbc.pool.OracleDataSourceFactory</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc racle:thin:myschema@127.0.0.1:1521:mysid</value>
</parameter>
<parameter>
<nameuser</name>
<value>scott</value>

It should work fine !
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic