Had this weird error, when connecting to Oracle Database
### The error occurred while executing a query ### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (ORA-00923: FROM keyword not found where expected )
Somehow it never happens on my MySql Configuration. Here is my configuration,
<bean id="dataSourceOracle" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"
p:driverClassName="oracle.jdbc.driver.OracleDriver" p:url="${db.url.oracle}"
p:username="${db.username.oracle}" p:password="${db.password.oracle}"
p:initialSize="2"
p:maxActive="30"
p:maxIdle="10"
p:minIdle="3"
p:maxWait="30000"
p:removeAbandoned="true"
p:removeAbandonedTimeout="30"
p:validationQuery="SELECT 1" />
After investigating for a while, i found out that it happens because i use MySql’s specific validationQuery, “SELECT 1”. Changing it into “SELECT 1 FROM DUAL” make the error go away. 😛