Ship JDBC driver into WAR for Tomcat 7 - jdbc

Before updating to Tomcat 7 (from Tomcat 6) I was able to ship MySql JDBC driver with a WAR file. I wasn't experiencing any issues creating JNDI data source with Tomcat 6 (maybe memory leaks on redeploy).
However, I'm attempting to deploy the same WAR (with the MySql driver) on Tomcat 7 using new connection pooling and getting :
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
I do understand that the more appropriate place for JDBC drivers would be CATALINA_HOME/lib.
Does the new connection pooling absolutely requires all JDBC drivers to be in CATALINA_HOME/lib? Or some configuration can allow me to ship the driver within WAR.

Yes. The driver should be in CATALINA_HOME\lib especially if you want to use Tomcat's pooling
From: Tomcat 7 Connection Pooling
Before you proceed, don't forget to copy the JDBC Driver's jar into
$CATALINA_HOME/lib.

Related

JavaFX Application Image with ojdbc driver

I'm currently trying to deploy a JavaFX Application with jlink. I have added the Maven Dependency for the jdbc Driver to establish a Connection to our Oracle Database . When I'm starting the Code from IntelliJ it is working fine. After the image is created the Application cannot find any suitable driver for the Database Connection.
Can anyone tell my how i include the jdbc dependeny in jlink ?

Glassfish with Oracle DS

I am using glassfish 3.1 and configure Oracle Datasource. However, I tried to Ping from glassfish admin console, but hitting an error with oracle.jdbc.pool.OracleDataSource not found. What could be the Issue?
As per http://docs.oracle.com/cd/E18930_01/html/821-2432/gkyan.html - you need to insert Oracle jdbc driver manually as it does not come bundled with Glassfish 3.1 installation. Just put the required jar into domain/lib directory.
Driver jar is downloadable from http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html

Oracle 12 c RAC connection issue in jboss 4.2.3 through datasource

We were using oracle 11g, in jboss 4.2.3 using datasource xml file .It was working fine.Now we moved to oracle 12 c rac version. we changed the url in datasource xml file but it is giving [org.jboss.resource.connectionmanager.JBossManagedConnectionPool]Throwable while attempting to get a new connection: null
but using same url in jdbc connection using Class. forName(....), It is working proper.
Please help me out , why we are not able to connect through datasource xml file.
our configuration :
jboss 4.2.3
oracle 12c rac
jdk 1.6
ojdbc6.jar
Try adding a new datasource(12c one) from the JBOSS console, rather than doing this manually.

Difference between a Spring datasource and a Tomcat datasource?

What is the difference between a Spring datasource and Tomcat datasource? Any pro's / con's? Is there a favored choice?
When using a Tomcat datasource you have to drop the JDBC driver JAR file(s) in Tomcat's classpath (the Tomcat/lib). This is sometimes not affordable/possible, for example when it concerns 3rd party hosting with zero server admin rights. When using a Spring managed datasource, it's sufficient to just drop the JDBC driver JAR file(s) in webapp's classpath (the Webapp/WEB-INF/lib). Plus, I'd imagine that you've in Spring the additional benefit that you don't need to grab the DataSource manually. Also, you have the freedom of choosing a specific connection pool. Also, Tomcat ships with DBCP builtin as default connection pool which is not the best choice per se. With Spring, you could for example choose BoneCP above DBCP without the need to fiddle with Tomcat default configuration/classpath.
If you have a datasource in the Spring config, you associate it with a Tomcat datasource when you are in a web application. You can associate it with something else, for example Spring DriverManagerDataSource when you run unit tests.

How to override TOMCAT Oracle ojdbc14 driver in the application?

The TOMCAT server is using an Oracle 9G ojdbc14 driver to its jndi connections in the /common/lib folder.
My web application uses Maven + Spring and I'm getting the dataSource using Spring jndi features.
I'm trying to bypass TOMCAT old ojdbc14 driver with a newer one (ojdbc14 10.2.0.4.0).
I've tried putting the jars in the WEB-INF/lib folder as a project dependency, but it doesn't work the application keeps using the old oracle driver that is in the TOMCAT folder.
I'm trying to bypass the TOMCAT oracle driver because I cannot update it to the newest version because there are lots of other projects using it.
Does anyone have a clue?
This won't work, Tomcat won't use the JDBC driver of your webapp to create a connection pool. In other words, you'll have to either replace the version in common/lib or to use a standalone connection pool at the application level.

Resources