• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Database connectiivity Error using DataSource

 
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using a databse connectivity in jsp page & it givs me an exception:

javax.naming.NamingException: Cannot create resource instance
in server.xml my entry is.
//--------------------------------------------------------------------

<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:@80.0.0.12:1526 RACLE</value>
</parameter>
<parameter>
<name>username</name>
<value>sol</value>
</parameter>
<parameter>
<name>sol</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>
//--------------------------------------------------------------------
web.xml

<resource-ref>
<description>DATA SOURCE FOR TRACK JOB SHEETS</description>
<res-ref-name>jdbc/myoracle</res-ref-name>
<res-type>javax.sql.Datasource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
//----------------------------------------------------------------------
// CODE FOR GETTING CONNECTION
InitialContext initCtx=new InitialContext();
Context ctx=(Context) initCtx.lookup("java:/comp/env");
DataSource ds=(DataSource)ctx.lookup("jdbc/myoracle");
//-------------------------------------------------------------------

thanks
 
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you have the oracle driver jar in <TOMCAT_HOME>/common/lib?

http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html
 
Vijay Kumar
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi James Carman
I went through with given URL... I am doing every thing right..
oracle driver is at right place under $TOMACAT_HOME$/COMMON/LIB/

GENRATED THIS EXCEPTION>>>>

org.apache.jasper.JasperException: Cannot create JDBC driver of class '' for connect URL 'null', cause: null

thanks
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Vijay Kumar:



Is it a typo? I think it should be like

 
Vijay Kumar
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Adil I have typed correctd..
bt now My code is givin error

Cannot create JDBC driver of class '' for connect URL 'null', cause: null


although in server.xml & web.xml contains the correct entries
in server.xml I have supplied the driverClassName ,url.

Thanks
 
Vijay Kumar
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all
thank..
my has been resolved....

vijay
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Vijay Kumar:
hi all
thank..
my has been resolved....

vijay



what was the real cause mate?
 
You ought to ventilate your mind and let the cobwebs out of it. Use this cup to catch the tiny ads:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic