We need the ability to failover from one database host to the other in the case that the one we’re currently connected to goes down. From what we’ve read, “Transparent Application Failover (TAF)” and “Fast Connection Failover (FCF)” are only available on Oracle 10 and higher. But our environment has Oracle 9.2.0.8.
What would be the best java solution to ensure our database connections failover? Using the oci driver seems to a better solution than the thin driver, however, we keep getting the “Unsatisfied Link Error: ocijdbc11.dll not on java.library.path”. We don’t have ocijdbc11.dll, but we do have ocijdbc10.dll in ${ORACLE_HOME}/bin
Environment:
Database = Oracle 9.2.0.8 with a RAC supporting two servers
Server = Solaris 10
Clients = Windows XP, service pack 3
JDK = 1.6.0_20
Library = ojdbc6.jar
Clients have Oracle thick client
10.1.0.2 installed. This gives them ocijdbc10.dll in their oracle bin directory
Our connection string in tnsnames.ora:
MY_SID =
(DESCRIPTION=
(FAILOVER=on)
(ADDRESS=(PROTOCOL=tcp)(HOST=host1)(PORT=1521))
(ADDRESS=(PROTOCOL=tcp)(HOST=host2)(PORT=1521))
(CONNECT_DATA=
(SERVICE_NAME=db.fully.qualified.name)
(FAILOVER_MODE=
(TYPE=select)
(METHOD=basic))))
We create a datasource as follows:
BasicDataSource ds = new
BasicDataSource();
ds.setUsername(“username”);
ds.setPassword(“password”);
ds.setUrl(“jdbc:oracle:oci:#MY_SID”);
ds.setDriverClassName("oracle.jdbc.driver.OracleDriver");
If you're getting “Unsatisfied Link Error: ocijdbc11.dll not on java.library.path” against a 10g client, sounds like you're using the 11g jdbc drivers. You need to use the 10g jdbc drivers.
Related
I want to connect to an old Oracle9i Release 9.2.0.4.0 database with SQLDeveloper 21.4.3 and I followed this answer How to change default JDBC driver of Oracle SQL Developer?.
The difference is just the versions of SQLDeveloper (21 instead of 20) and Oracle Instant Client (21.3 instead of 11.2.0.4.0). In my case both are the latest ones.
My OS is also Windows 10, 64bit.
Testing the client and connection as described are successful. But when actually connecting to the database SQLDeveloper hangs and can only be closed by TaskManager.
I tried both connection types: simple and with user defined URL jdbc:oracle:thin:#172.31.10.3:1521:LZH. This URL works in other applications like SQL Workbench/J using oracle driver ojdbc14_g.jar.
I also tried to set this jar file in SQLDeveloper preferences as external jdbc driver. But I guess here only non oracle drivers like postgreSQL make sense, but don't know. It doesn't make a difference anyway.
Thanks for any suggestion!
You cannot connect an Oracle Client version 21 to an (more than 20 years old) Oracle 9i database. See Client / Server Interoperability Support Matrix for Different Oracle Versions
Maybe ask Oracle support to get an older version of SQL Developer.
Oracle provided me a link for older
Instant Client Versions.
Version 11.2 works fine with SQLDeveloper 20.2.
SQLDeveloper 21 only supports client versions 19 and higher.
We are facing issue with the the query timeout property on Db2, it is working when we are running the app in WebSphere, then we moved to Tomcat, this issue was recently caught up by a very long query that hangs very long until timeout after 45 minutes, some pieces of the code we have as below, they haven't been changed since moving to Tomcat:
CallableStatement cs = statementFactory.createCallableStatement(getConnection(), source.getSQL(),
statementConfig);
cs.setQueryTimeout(10);
boolean resultSetAvailable = cs.execute();
if (resultSetAvailable) {
resultSet = cs.getResultSet();
} else {
resultSet = CallableStatementParamsUtils.checkForOutResultSet(cs, storedProc);
}
I set up the timeout to be 10 secs, but it didn't timeout at all, anybody knows why?
The difficulty is Db2 driver is not open source, not able to debug it, How can I solve this issue using Db2?
In this case, the use of a jdbc type 4 driver appeared to help to resolve the issue.
Note that the IBM db2 jdbc driver supports tracing for problem determination as described here.
When dealing with jdbc issues with Db2, it is always helpful to ensure you are using the most recent jdbc driver, available via this page.
From the comments, the previous jdbc driver was a type-2 driver (which supports query timeouts only in specific configurations as IBM documents in the Db2 knowledge center, the notes are copied below).
The various IBM notes on this page concerning queryTimeout support in jdbc are essential reading , viz:
For DB2 for i, this method (setQueryTimeout) is supported only for a seconds value of 0.
For IBM Data Server Driver for JDBC and SQLJ type 2 connectivity on Db2 for z/OS, Statement.setQueryTimeout is supported only if
Connection or DataSource property queryTimeoutInterruptProcessingMode
is set to INTERRUPT_PROCESSING_MODE_CLOSE_SOCKET.
For IBM Data Server Driver for JDBC and SQLJ type 2 connectivity on Db2 on Linux, UNIX, and Windows systems, Statement.setQueryTimeout is
supported only if Connection or DataSource property
queryTimeoutInterruptProcessingMode is set to
INTERRUPT_PROCESSING_MODE_STATEMENT_CANCEL.
For the IBM Data Server Driver for JDBC and SQLJ Version 4.0 and later, Statement.setQueryTimeout is supported for the following
methods:
Statement.execute
Statement.executeUpdate
Statement.executeQuery
Statement.setQueryTimeout is supported for the Statement.executeBatch
method only when property queryTimeoutInterruptProcessingMode is set
to INTERRUPT_PROCESSING_MODE_CLOSE_SOCKET (2).
I'm struggling with jdbc connection to oracle database, which should I use?
The tomcat-jdbc.jar (inside tomcat) or oracle ojdbc6.jar (official by oracle)
What are the difference between the two driver?
(ojdbc6 version 11.2.0.4 guarantee to me to work with oracle 12c db and oracle 10 db could do the same the tomcat-jdbc.jar??)
Actually, they are different libraries. tomcat-jdbc.jar is the default Tomcat connection pool (in Tomcat version 8.5) and it's responsible for managing connections, allowing you fast access to already created ones, whereas ojdbc6.jar is your actual JDBC driver from Oracle that provides database connectivity to Oracle Database server.
Other words, you cannot use tomcat-jdbc.jar alone in case you want to "talk" to your Oracle Database, but it's possible to use ojdbc6.jar without pooling, although it's not recommended due to perfomance drop in most cases.
Here is a good explanation:
ojdbc6.jar -
What is ojdbc6.jar file?
Connection Pool - https://en.wikipedia.org/wiki/Connection_pool
I am trying to connect to Oracle Database 10g Express Edition. While connecting am getting the error as
BW-JDBC-100033 "Configuration Test Failed. Failed to find or load the JDBC driver: tibcosoftwareinc.jdbc.oracle.OracleDriver"
Can anyone please help me on this issue?
Which version of TRA are you using? Be aware that from TRA 5.7.0 onwards, the DataDirect drivers (such as tibcosoftwareinc.jdbc.oracle.OracleDriver) are no longer shipped with the product. If that is your case, you have 2 options:
Download the TIBCO Database Drivers Supplement, which includes the DataDirect drivers.
Download the Oracle JDBC driver, drop the appropriate ojdbc jar in the <TIBCO_HOME>/tpcl/5.x/jdbc folder (create the folder if it doesn't exist) and use the oracle.jdbc.driver.OracleDriver reference in your BW project.
I am getting below exception with Oracle JDBC ojdbc14_g.jar drivers:
java.sql.SQLException: ORA-06413: Connection not open.
My Oracle version is:
My machine and server details are:
I am able to connect to production DB from my development environment, but after installing application in production server my application is unable to connect to locally installed database. I am getting above said exception.
Below is my connection URL:
jdbc:oracle:oci8:#127.0.0.1:1521:XE
Try to replace oci8 with thin. JDBC over (native) OCI require some knowledge and experience. You have to install and configure Oracle client 1st.
See http://docs.oracle.com/cd/B28359_01/java.111/b31224/instclnt.htm