Bookmark Topic Watch Topic
  • New Topic

Databse Connectivity Error  RSS feed

 
Vijay Kumar
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
  • Report post to moderator
I am using a databse connectivity in jsp page & it givs me an exception:
javax.servlet.ServletException: Cannot create JDBC driver of class '' for connect URL 'null', cause: null

although there is a proper entry in server.xml for driverClassName & url

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");
conn=ds.getConnection(); // error is generated at this line
 
Yu Tao
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Report post to moderator
Note that the JDBC libraries are required by a definition of a resource
in server.xml (not by your application ). Try putting them drivers in
$TOMCAT_BASE/common/lib, to make them available to that resource.
 
Vijay Kumar
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
  • Report post to moderator
hi Yu Tao

could you tell me which JDBC libraries are required. all the nesssary lib are there..

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66157
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please continue any discussion here.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!