I have multiple db connection from my application. Recently we upgraded ojdbc version to 8 (ojdbc8) and some of the db connection began throwing exceptions, especally when executing stored procedures using spring jdbc templates. Those are databases with oracle version 9. If we switch back to older driver (ojdbc7) this works but other db integration fails. Is there any way I can use ojdbc7 driver for one database connection and ojdbc8 driver for others? We are using tomcat-8 and can we do this in server.xml?
I don't think you can load more than one version of a jdbc library in tomcat's CLASSPATH.
You could try though loading your jdbc connection pool on your application context META-INF/context.xml and adding the jdbc library in WEB-INF/lib folder for each application. If this works it would mean that your tomcat would load each jdbc library again and again for every application.
I would highly suggest splitting your applications into 2 tomcats (one with ojdbc7 and one with ojdbc8), so that you have a more clean setup.
Related
I am trying to configure a JDBC XA resource in Tomcat 8 that can be used with Atomikos to implement transactions using Spring and JTA.
However, I have not found a tutorial describing how the configuration must be done. The documents I have read begin with the configuration in Spring and Atomikos, but they do not mention how to configure Atomikos with Tomcat. In addition, their examples configure JTA/XA transactions with PostgreSQL and/or MySQL, but not mention databases in AS/400.
I have found this post, but the response is not clear to me.
Does someone know how to configure a JDBC/XA resource in the server.xml configuration file used by Tomcat?
You can use databases in IBM AS/400-iSeries machines using the (1) Universal DB2 driver, if that option has been enabled in the server, or (2) the traditional IBM Toolbox for Java or jt400/JTOpen opensource library.
Some years ago, I used the JTOpen JDBC XA drivers for accessing the databases and the datafiles in the iSeries. It works just like any other JDBC driver.
If you want to create an stand-alone program, IBM provides documentation for implementing JDBC XA distributed transactions using JTOpen drivers.
If you want to use an application server, you only need to configure the datasource (just like any other database). You may check IBM documentation for configuring XA datasources in Websphere.
If you want to use Atomikos, the XA-datasource must be configured just like you configure any other JTA/XA connection. There is a forum entry describing an example.
I have found this post, but the response is not clear to me.
Check the documentation for Atomikos-Tomcat integration. The resources must be defined in the TOMCAT_HOME/conf/context.xml file. There is an example you can download to understand the Atomikos-Tomcat configuration.
I have completed my semester project using jsp,tomcat server,mysql database and jdbc driver.I dont have any idea how to publish it on internet.It is working fine in localhost.Please help.
Basically you need to purchase a domain and a hosting place. Your hoster should support Tomcat and MySQL service. Then you need to build up your database, and deploy your application on the Tomcat server. And voila!
Note: The jdbc driver is not an issue since it can be included within your application...
I'm planing to develop a web application with spring framework. I am using DB2 8.1 as database ,but did not find any JDBC driver for accessing DB2 from java.
For the most recent JDBC drivers, you can get them from http://www-01.ibm.com/support/docview.wss?uid=swg21363866
The drivers for 8.1 are not there, but the names are there. You can use any from the 9.1 version to connect to the 8.2 server.
I am trying to connect to Teradata using jdbc. My application is running in JDK 1.4.
The url i am using is "jdbc:teradata:///TMODE=ANSI,CHARSET=UTF8";
I get "No suitable driver error" when i try to run using JDK 1.4.
However, I am able to run my app using JDK 1.7 with the same url.
I have both terajdbc4.jar and tdgssconfig.jar in my Netbeans libraries.
You probably use the wrong version of either Java, Teradata JDBC or Teradata Utilities (TTU).
Take a look here, what is compatible with what: Compatibility
The matrix is part of this reference which holds information how to use JDBC with different Application Server like JBoss, Tomcat, WebSphere, ColdFusion, WebLogic, SAP etc.
How can I use MySQL 3.x and MySQL 5.x simultaneously from my Java application if the two versions need different versions of JDBC drivers but the driver class name is the same?
For MySQL 3.x I downloaded MySQL Connector/J 3.0.17 and for MySQL 5.x I have MySQL Connector/J 5.1.12. How can I use them both?
First check whether (as mentioned by #DaveHowes +1) you can use JDBC driver for v5 with DB v3. It probably works. In this case you have no problem.
If it does not work you have to use separate class loaders for 2 connectors to 2 different DBs. So, neither v5 nor v3 JDBC driver will not be in "regular" classpath of your application. Instead you should create some kind of wrapper that will instantiate its own UrlClassLoader: and start driver. The mentioned collector should expose API that allows you to perform JDBC query. I hope this will work. All this if you are using pure JDBC. If you are using some kind of tools (e.g. Hibernate, iBatis etc.) I wish you good luck :) and suggest to ask more specific question that mentions tool you are using.