Weird Behaviour of Oracle 11g to 12C - java

My application runs select sql queries using JDBC driver on Oracle and stores the data in Result set. Then by using buffer writer/file writer writes information to xml.
** Weird Behaviour : Same code when runs with Oracle 11g takes 2 hrs to complete and for 12 C it takes # 12 hrs.
** JDBC driver I am using is compatible with 11g and 12c. Data is same on both the DBs. Both DB are independent instance, so no question of migration problems.
Can somebody please help, what how can I debug for this ?
** select queries uses bind parameter IN clause and has 1000 values in it.

IT seems, there is a bug with Oracle 12C. Working with Oracle support.

Related

How to connect to Oracle9i with SQLDeveloper 21?

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.

jdbc DB2 queryTimeout not working as expected

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).

jooq 3.11.9 with MySQL Ver 8.0.11

I am using jooq version 3.11.9 and I have MySQL Ver 8.0.11 installed on my local. While initiating connection of jooq with Mysql I get the following error:
org.jooq.exception.DataAccessException: SQL [select 1 as `one` from dual where exists (select 1 as `one` from `mysql`.`proc`)]; Table 'mysql.proc' doesn't exist
I understand MySQL Ver 8.0.11 doesn't contain this table. So what is the solution? I cannot downgrade the MySQL versions as other projects are already running with this version.
As you can see in the mysql Release notes:
Previously, information about stored routines and events was stored in the proc and event tables of the mysql system database. Those tables are no longer used. Instead, information about stored routines and events is stored in the routines, events, and parameters data dictionary tables in the mysql system database. The old tables used the MyISAM (nontransactional) storage engine. The new tables use the InnoDB (transactional) engine.
That query is there precisely to check whether you're running on MySQL 8+. It should not cause an error or even a stack trace (but maybe a debug message). You can safely ignore it.
If you found an error or stack trace message, or if this causes your code generation to fail, it might be a bug in jOOQ's logging configuration, which I would invite you to file here: https://github.com/jOOQ/jOOQ/issues/new

How to access a UniqueIdentifer column from Java's JDBC-ODBC bridge

I'm currently working on a java program that will access an Microsoft SQL Server using the JDBC-ODBC bridge driver provided in the Java distribution.
Everything seems to be setup correctly and I can query basic data from the database, but when I try to run a query that gets a UniqueIdentifer field in it, when I do the subsequent ResultSet.getString() it fails with:
java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Numeric value out of range
Has anyone experienced anything like this before? This works using the JDBC driver provided by Microsoft, but the customer wants to use the DSN they created.
If this is helpful when I run a Connection.getMetaData(); the UniqueIdentifer field returns a DATA_TYPE of 1111
If you call a batch of two or more Microsoft SQL Server stored procedures by using the ODBC Driver for SQL Server and by using the ODBC canonical {call X} method, you may receive the following error message from the driver:
Numeric Value Out Of Range
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. This problem was first corrected in Microsoft SQL Server 2000 Service Pack 3.

Streaming large result sets with MySQL 4.1.x + Connector/J

I'm trying to get a large result set to stream and having no luck. The MySQL docs are somewhat unclear as to whether this should even work. E.g.:
When using versions of the JDBC driver earlier than 3.2.1, and connected to server versions earlier than 5.0.3, the `setFetchSize()` method has no effect, other than to toggle result set streaming as described above.
I'm using MySQL 4.1.19 with Connector/J 5.1.6. My code is basically:
stmt = conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
stmt.setFetchSize(Integer.MIN_VALUE);
stmt.executeQuery(“select * from huge_table”);
Are streaming result sets possible with MySQL 4.1.x? And if so, how?
What you are looking for is called "unbuffered query" in MySQL lingo, but a quick search seems to indicate that:
MySQL only supports it starting from version 5.0
JDBC doesn't support it

Categories

Resources