Reputation: 196
I am trying to connect to an oracle DB with myBatis and it returns the following error:
GRAVE: ERROR.nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Cannot create JDBC driver of class '' for connect URL 'null'
### The error may exist in com/iberdrola/persistence/dao/BusquedaDao.java (best guess)
### The error may involve com.iberdrola.persistence.dao.BusquedaDao.getResultadosBusqueda
### The error occurred while executing a query
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Cannot create JDBC driver of class '' for connect URL 'null'
I have the DB configuration in the tomcat server.xml
<Resource auth="Container" driverClassName="oracle.jdbc.driver.OracleDriver" maxIdle="1" maxTotal="20" maxWaitMillis="-1" name="jdbc/nombreBD" password="pass" removeAbandonedOnBorrow="true" removeAbandonedTimeout="60" type="javax.sql.DataSource" url="jdbc:oracle:thin:@//IP:PUERTO/AWDD" username="user"/>
I don't understand why it tells me that class is equal to "" and url 'null' when as seen, if I have those settings added.
I don't know what I could be missing or what I could be doing wrong.
Any missing info, I add it without problems.
Thanks in advance.
Upvotes: 1
Views: 586
Reputation: 79035
You need to integrate Tomcat with iBatis using a configuration similar to the one mentioned below:
<transactionManager type="JDBC" >
<dataSource type="JNDI">
<property name="DBJndiContext" value="jdbc/nombreBD"/>
</dataSource>
</transactionManager>
Check this to learn more about it.
Upvotes: 1