If you are tired of coping with errors like:
- DBCP problem “Name jdbc is not bound in this Context”,
- Cannot create JDBC driver of class ” for connect URL ‘null’,
take a few deep breaths, relax and check out this information:
The most probable cause of your problems is misconfiguring Resource section when you tried to bind a connection pool as JNDI resource. To improve this situations, you might find proper solution using this steps:
- Check whether you’ve installed Tomcat 5.5. If you have, be aware that resource configuration in 5.5 version has changed. Here is an example of META-INF/context.xml file:
[code lang="xml"]
auth="Container"
type="javax.sql.DataSource"
driverClassName="oracle.jdbc.OracleDriver"
factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
url="jdbc:oracle:thin:@127.0.0.1:1522:ORADB"
username="scott"
password="tiger"
maxActive="150"
maxIdle="30"
maxWait="10000"
removeAbandoned="true"
validationQuery="select dummy from dual"
/>
[/code](This file will be used by Tomcat as context description for this web application by renaming and copying it into /conf/Catalina/webapp-10.10.xml)
- Check a WEB-INF/web.xml file of the installed web application, it should contain:
[code lang="xml"]
...............
Oracle database
jdbc/webappdb
javax.sql.DataSource
Container
[/code] - Put your JDBC driver (e.g. ojdbc14.jar for Oracle) in $TOMCAT_HOME$/common/lib directory.
RESOURCES:
- DBCP problem “Name jdbc is not bound in this Context”, SOLUTION
- Cannot create JDBC driver of class ” for connect URL ‘null’
- JNDI Datasource HOW-TO
- Commons DBCP – Configuration
