The resource-ref connects your webapp to the Tomcat connection pooler. It establishes the JNDI name of the datasource object (java:/comp/env/jdbc/mt\yDataSource).
However, if you use a brute-force JPA implementation, it will create its own connection manager within the webapp, so this object will not be referenced.
That's not entirely a good idea, since it's often desirable to manage resources at the server level, but there's nothing otherwise wrong with it.
Myself, I'm using Spring to manage JPA and I have Spring configured to get the persistence parameters from the JNDI definition, but it's a bit more complicated that way. On the other hand, because I'm using the external pool, I can switch from test to production databases without changing persistence.xml, web.xml, recompiling any classes or rebuilding the WAR. I manage everything from the external Tomcat definitions for the test/production server.
An IDE is no substitute for an Intelligent Developer.
Joined: Jun 28, 2008
so is it better to provide additionally this information in my web.xml?:
The problem is, when I provide the above information, then I get this error:
I use mySQL and have definitly the lib "mysql-connector-java" in the tomcat-lib-folder (not in the applications web-inf/lib).
When I do NOT provide the resource-ref-information, then I get NO errors and all works.
Do you know, what is wrong?
(Maybe the DBCP of tomcat and the use of Hibernate JPA? I guess, Hibernate has its own (better?) connection pool?)
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com