I have a Spring Based Web App running under tomcat 6. Now, I want to use c3p0 connection pooling instead of tomcat's default DBCP. So, from the c3p0 help doc, I have defined the data source in context.xml
something like:
<Resource name="jdbc/sample" auth="Container"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@someServer:1551:xyz"
username="userName"
password="pwd"
validationQuery="SELECT 1 FROM dual"
testOnBorrow="true"
testWhileIdle="true"
factory="org.apache.naming.factory.BeanFactory"
type="com.mchange.v2.c3p0.ComboPooledDataSource"
maxPoolSize="20"
minPoolSize="5"
acquireIncrement="1"
/>
Now, the documentation says, I should Include the following in web.xml
:
<resource-ref>
<res-ref-name>jdbc/sample</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
I also have the following in applicationContext.xml
:
<jee:jndi-lookup id="sampleDataSource" resource-ref="true"
jndi-name="jdbc/sample" />
When I start the tomcat, I get
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
Without c3p0 and using default connection pooling in tomcat6 works fine.
Any help would be appreciated.