I was testing out springframework's jdbc with apache's dbcp when I came across the exception Cannot create JDBC driver of class 'oracle.jdbc.driver.OracleDriver' for connect URL 'jdbc:ORACLE:thin:localhost:1521:orcl'
My configuration looked like this below
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="${jdbc.driverClassName}"/>
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
</bean>
When I used spring DriverManagerDataSource class i was able to access the oracle instance with the same configuration.
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${jdbc.driverClassName}"/>
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
</bean>
This was strange to me. After a night's rest, I was feeling refreshed for the morning to tackle this strange exception when I thought about case sensitivity. So I change my connection URL from jdbc:ORACLE:thin:localhost:1521:orcl
to this jdbc:oracle:thin:localhost:1521:orcl
and everything just worked fine. I guess apache's dbcp was a little sensitive.