1

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.

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

5 Comments

Hi, thanks for the reply. I don't have that configuration, I have what I have put above in the tomcat server.xml and in META-INF / context.xml I have the following: <ResourceLink global="jdbc/nombreBD" name="nombreBD" type="javax.sql.DataSource"/> Is it necessary to add what you comment?
@tripossi - You need to integrate Tomcat with iBatis. Check the update.
Ok, don´t worry!! I will do what you say. Thank you again Arvind!
I did it! I have added the resource that I had in server.xml to the META-INF / context.xml file and also I have added the ojdbc7.jar connector in the local path of tomcat / lib
Great! Wish you success!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.