Discussions

Web tier: servlets, JSP, Web frameworks: servlet database connectivity problem in tomcat 5.5.11

  1. hi all ...
    im using oracle 9i(orahome90) and tomcat 5.5.11.. i have made a servlet that performs database connectivity..but unfortunately its not happening .... i have tried all the option available on net but to no avail...... some solutions say that i need to place ojdbc14.jar in my install_dir\common\lib directory.... but im unable to find such jar file on my system... i have done full system search and no such file is found....... i have made the following changes in my conf\server.xml as per a suggestion on the net.... ihave included the following between <GlobalNamingResources> and </GlobalNamingResources>...

    <Resource name="jdbc/<alias>"
                  auth="Container"
                  type="javax.sql.DataSource"
                  driverClassName="oracle.jdbc.driver.OracleDriver"
                  factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
                  url="jdbc:oracle:thin:@<server>:<port>:<sid>"
                  username="<user>"
                  password="<password>"
                  maxActive="20"
                  maxIdle="10"
                  maxWait="-1" />
                  
    ALSO I have made changes to my conf\context.xml and between <Context> and </Context> i added:

    <ResourceLink global="jdbc/<alias>" name="jdbc/<alias>" type="javax.sql.DataSource"/>
    .....
    one thing i m not sure of the <alias>..what should i provide here... will it be my database name...

    ALSO In the <CONTEXT>/WEB-INF/web.xml between <web-app> and </web-app> i added:

        <resource-ref>
            <description>Oracle Development Datasource</description>
            <res-ref-name>jdbc/<alias></res-ref-name>
            <res-type>javax.sql.DataSource</res-type>
            <res-auth>Container</res-auth>
        </resource-ref>...

    Now the error that it is showing says.......
    Exception: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class 'oracle.jdbc.driver.OracleDriver'
    i dont know what to do....... im not able to proceed further unless i would know how to make a database connectivity
    help is needed asap.....
    so please guys help me and solve my problem
    thanks in advance....

    Threaded Messages (1)

  2. Install the Driver[ Go to top ]

    It looks like you need to copy the Oracle driver .jar file in the /WEB-INF/lib directory of your web application.

    As far as the alias to use, the ResourceGlobalLink global alias and the alias in your GloablNamingResources needs to be the same. The ResourceGlobalLink name alias the the alias in your web.xml need to be the same. Now it's totally okay for ALL of them to be the same, it keeps things simple...