Cannot create JDBC driver of class ” for connect URL ‘null’ Oracle Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of Cannot create JDBC driver of class ” for connect URL ‘null’ Oracle without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I know this questions has been asked before but the answers does not addressing the problem in my case.

http://stackoverflow.com/questions/11516747/cannot-create-jdbc-driver-of-class-for-connect-url-null-i-do-not-underst

The answer selected by the user talks about the different approach, With the help of the suggested approach my application is working fine but I am want to do it in below manner.

Wanted to put my JNDI xml file containing db connection details in

 tomcat7.0confCatalinalocalhost

and when I am running the tomcat from command prompt It should make a connection with the database. In this case my xml file name is application.xml. Running application from command prompt giving me error as

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

Steps I have tried:

  1. below is the XML file created JNDI resource:

`

 <?xml version="1.0" encoding="UTF-8"?>
    <Context path="/application" reloadable="false">
    <Logger className="org.apache.catalina.logger.FileLogger" prefix="application." suffix=".log" timestamp="true"/>
    <Resource name="jdbc/application" 
    factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
    auth="Container"
    type="javax.sql.DataSource" 
    username="abc"
    password="abc"
    driverClassName="oracle.jdbc.driver.OracleDriver"
    url="jdbc:oracle:thin:@<<server_address>:1522:<<sid>>"
    maxActive="20" maxWait ="10000" maxIdle="10"/>             
    </Context>

` with the information

  1. web.xml have a entry for the above resource as

`<resource-ref>
    <description>Connection Pool</description>
    <res-ref-name>jdbc/application</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
  </resource-ref>

`

  1. Put ojdbc6.jar file in tomcat/lib folder.

I am making sure that I have not put ojdbc6.jar in both tomcat and my project and I am using oracle 12c as a database.

Answer

The issue was with the filename. My application WAR name was “TomcatExample.war” and xml name was “tomcatexample.xml” It is case sensitive in tomcat 7 and that is the reason it was not picking up the file. Changes to “TomcatExample.xml” works for me. Thank you so much all for your help. Cheers!!!

We are here to answer your question about Cannot create JDBC driver of class ” for connect URL ‘null’ Oracle - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji