How to override TOMCAT Oracle ojdbc14 driver in the application? - spring

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.

Related

Where to install JDBC driver for Vaadin app run from IntelliJ using bundled Jetty servlet container?

I will ultimately be deploying my Vaadin web app to Tomcat servlet container.
In Tomcat, JDBC drivers generally need to be stored outside of the web app, in a separate Tomcat folder. So I do not want to add any JDBC driver as a dependency within my Maven build settings.
In the meantime, while developing I am running the Vaadin 8 or 8.1 web app (created from the vaadin-archetype-application Maven archetype) from within IntelliJ 2017.1 using the Jetty servlet container that is somewhere mysteriously bundled (“embedded”?) within the project.
Where can I store my JDBC driver jar file(s) while developing with IntelliJ-Jetty combo?
This depends on wether you use Tomcat or Jetty as an "old fashioned" appserver, or if you use it as an embedded component in your application. The archetype you have used probably assumes the latter (adds jetty-plugin to pom), while it sounds like you want the first scenario. In that case, just install the driver in the tomcat or jetty instance you want to use, and create a run configuration in IntelliJ for that instance. If you need the driver compile-time, add it to the pom with scope "provided". If you want to just have it available to the jetty-plugin, add it as a dependency for that plugin (inside the plugin definition).
See this related question for more info about including dependencies only for embedded jetty.

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

Migrate a Spring 3.1 Java project from Eclipse to Netbeans

I am migrating a Spring Java Project (using Oracle DB) from Eclipse to Netbeans. It was almost easy but I did not succeed in acessing to the DB (the application was using spring security for logging). The logon was unsuccessful (Access denied). I suppose that in the Netbeans version the Oracle Db was not accessed. I left the context.xml file in the same META-INF directory, with the same name and the same content, than that of the Eclipse version. Is this right ? Why the access is denied in the Netbeans version ?

Enable OJDBC Logging on JBoss

I'm facing database connection issue when using ojdbc6.jar. Therefore, I would like to enable logging by using ojdbc6_g.jar.
I am using JBoss AS 7.1.
How to add these Java options:
-Doracle.jdbc.Trace=true
-Djava.util.logging.config.file
Do I have to add to Eclipse or JBoss or Oracle database ? My guess would be Eclipse.
Please help.
the JDBC driver has to be in the classpath of the JBOSS server otherwise JBOSS could not be able to find the oracle Server
this could also be a network issue
also you mix several concept in once line ; weird
so we need more details about your problem, for example errors ; logs etc.

Ship JDBC driver into WAR for Tomcat 7

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.

Resources