-
Notifications
You must be signed in to change notification settings - Fork 38.4k
Oracle 12c JDBC driver throws inconsistent exception from getParameterType (affecting setNull calls) [SPR-13825] #18398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Juergen Hoeller commented I suppose we will go with explicit detection of compliant Oracle JDBC driver versions where we can reliably assume that they do support That said, the Oracle driver's choice of exception is really misleading there. It means to say "not supported for this particular statement" but chooses to throw an exception that indicates general lack of a particular JDBC feature... Anyway, even if that exception remains, we can certainly work around it. Juergen |
Tom Jahncke commented I agree that Oracle choice is very misleading and that getParameterType should work even when the table name is qualified. Thank you for looking into this so quickly! |
Juergen Hoeller commented Addressed through a Juergen |
Tom Jahncke commented I tested the fix with 4.2.5.BUILD-SNAPSHOT and it worked well. Thank you again for the quick turn around on this fix!! |
Juergen Hoeller commented Alright, thanks for the immediate feedback! Juergen |
Juergen Hoeller commented While this has been backported to 4.2.x, we won't backport it to the 3.2.x line since many other recent JDBC refinements haven't been backported there either. Generally, please upgrade to 4.2+ for proper Oracle 12 support. |
Juergen Hoeller commented Tom.Jahncke@gfs.com, since we have a side effect of this reported in #18764, could you please clarify whether you are using the Oracle 12 JDBC driver against an actual Oracle 12 database there? |
Tom Jahncke commented This was against a 11.2.0.4 Oralce database with the Oracle 12 JDBC driver. FYI, Oracle did eventually acknowledge this bug and created a patch for the underlying bug, however, that won't be part of their standard JDBC driver until the next official release of their driver. |
Juergen Hoeller commented Alright, thanks for the clarification... It looks like the Oracle 12 driver not only sometimes throws exceptions against the Oracle 11 database but even sometimes returns invalid values (according to #18764). We'll see what we can do to workaround that part. |
Tom Jahncke commented Oracle JDBC has yet another bug :( This results in a cursor leak when the getParameterMetaData method throws an exception. The cursor leak in my situation was noticed when the program was getting java.sql.SQLException: ORA-01000: maximum open cursors exceeded. Oracle does have a patch for this as for April 2016. You can look up oracle doc: "Cursor Leak / ORA-1000 From PreparedStatement.getMetaData() Method On Malformed Statements (Doc ID 2124104.1)" at support.oracle.com for more information. I am commenting here for visibility sake, as the Oracle docs don't show up in a Google search and I spend an entire day dealing with this. Hopefully, this saves someone else time. |
Tom Jahncke commented
|
Juergen Hoeller commented We have "spring.jdbc.getParameterType.ignore" already... Do you see a need for something beyond that? The behavior was a bit weird before when we would only stop trying |
Tom Jahncke commented I agree with what you stated. The risk / challenge is that every time getParameterMetaData throws an exception Oracle is leaving an open cursor behind, shame Oracle. Oracle has been aware of this bug since 2014 and they have a one off patch you can apply, but you have to seek this out. This will not be transparent to users and may not even be noticed until application gets to production. What makes this even worse is Oracle seems to have lots of situations where the SQL runs fine, but the getParameterMetaData throws an exception :( I am aware of spring.jdbc.getParameterType.ignore, what i was suggesting was a parameter like spring.jdbc.getParameterType.always (default to false) and then remove the Oracle driver / version check in StatementCreatorUtils and instead check to see if this variable is set. By the way, I am content leaving the code the way it is as it is working for me because I have applied the patch from Oracle. I am just attempting to consider the larger community. I leave the decision in your very capable hands. |
Felix Barnsteiner commented After upgrading to the latest spring version I also ran into the ticking time bomb of |
Gopi Popuri commented We are also facing java.sql.SQLException: ORA-01000 after upgrading the latest version.. Our configuration also same as Felix.. |
Juergen Hoeller commented I've created #19196 as a follow-up to this issue, considering more defensive - but still consistent - default behavior when running against Oracle 12c. It seems the only way out is to deactivate all |
Juergen Hoeller commented From all reports above and in #18764, it seems that this only occurs with the Oracle 12.x JDBC driver against an Oracle 11.x database system. Has anybody got insight into whether this happens against an Oracle 12.x database as well? Tom Jahncke, does the Oracle support ticket for the patch mention affected database versions? |
Juergen Hoeller commented A similar kind of leak for |
Tom Jahncke commented The Oracle docs on the bug are related to the JDBC driver affects RDMBS version 12.1.0.2 (in addition to the issues we are seeing with 11.2.0.4 RDMBS versions.) |
Tom Jahncke commented Here is the Oracle write up on the bug. They do have a patch for this, but you have to contact Oracle directly :( They only make new version of the JDBC driver in conjunction with a new version of the database. |
Juergen Hoeller commented So they're only going to ship that fix once an Oracle 13 JDBC driver gets released? Which might take a further year or two? sigh With the recent reports here and considering that #18764 is still open, it looks like we have no other choice than to ignore It's a shame that such an old JDBC feature - dating back to JDBC 3.0 in JDK 1.4, making it 14 years old (!) - still does not work properly today :-( |
Tom Jahncke commented I think they would release the patch when the release 12.2 (which was suppose to be this summer, but I believe is delayed.) I fully agree it is such a shame and makes me even more disappointed in Oracle. I agree with your proposed approach. |
Juergen Hoeller commented Revised for 4.3.3 and 4.2.8 now: |
Juergen Hoeller commented Tom Jahncke, all, this is available in the latest |
Kuassi Mensah commented Full disclosure: I work for Oracle. Regarding the following comment |
Tom Jahncke commented
|
Kuassi Mensah commented Bug fixes are also picked up by intermediate patchsets (4th digit) e.g., 12.1.0.2. |
Tom Jahncke commented
|
Kuassi Mensah commented Yes, bug fixes are posted indepedently of patch sets and available in a repository for supported customers. I understand your frustration; your experience is not the way things work. When you submit a technical assistance request (a.k.a. TAR), the support engineer should, after investigation, tell you whether this is a bug or not; if so, whether ther already is a fix or not; if so, point you to the fix. THis should only take the time o investigate the TAR and the time to pull the fix and apply. Best, Kuassi |
Tom Jahncke opened SPR-13825 and commented
This relates to: #15726
Using the oracle driver (ojdbc7 version 12.1.0.2.0) I ran across the following issue (I opened a support case with Oracle on the root cause of the issue. SR 3-11927085951)
Normally the Oracle driver works fine with following code:
However, it is possible for a statement to cause Oracle to throw an exception than then all statements going forward no longer use the JDBC 3.0 features to resolve the sql data type for null values.
I understand why driversWithNoSupportForGetParameterType exists and how it helps performance. However, since it is black or white once an exception is thrown the setNull never tries to use the JDBC 3.0 features again (until the app is restarted).
I can think of a few hackish ways to address this, but I am hoping you can come with a solid solution that is solid (My hackish ideas are along the lines or allowing a driver name to be injected that doesn't get added to the global set of drivers not supported.)
FYI, just by having an insert statement with a qualified table name causes the following exception with the oracle JDBC driver. (Without qualification no exception.):
Affects: 4.2.4
Attachments:
Issue Links:
Referenced from: commits e48ec4f, e1bdf55
0 votes, 6 watchers
The text was updated successfully, but these errors were encountered: