After migrating from Spring 4.1.7 to Spring 5.0.5 we have ORA-01000: maximum open cursors exceeded when using with Oracle 12c and ojdbc7 driver
Exception raised after following code
#SuppressWarnings("unchecked")
private void executeBatch(Map<String, Object>[] updateBatchParams) {
int[] updateResults = namedJdbcTemplate.batchUpdate(SQL, updateBatchParams);
The issue is very similar to https://jira.spring.io/browse/SPR-16139.
But we dont have ability to update ojdbc driver.
Any ideas how the issue can be fixed?
P.S. Created an issue in Spring jira
Juergen Hoeller:
There hasn't been any recent work on this. Since this is effectively
a bug in the Oracle JDBC driver, I'm afraid we won't be introducing a
workaround for an older driver at this point.
You could try setting spring.jdbc.getParameterType.ignore=true as a
system property on in a spring.properties file in the root of your
classpath, or use spring-jdbc-4.3.17 for the time being... with all
other jars set to 5.0.6 (which isn't officially supported but should
work fine in practice). I strongly recommend upgrading the JDBC driver
though.
Related
I've upgraded my application to use Spring Core version 5.0.8 (previously it was using version 4.3.6).
My app uses Postgresql 10.4 with JDBC driver version 42.2.5 and C3p0 version 0.9.5.2.
After the Spring Core upgrade, the application started throwing the following exception when trying to set the value of a CLOB column:
Method org.postgresql.jdbc.PgPreparedStatement.setClob(int, Reader, long) is not yet implemented.; nested exception is java.sql.SQLFeatureNotSupportedException: Method org.postgresql.jdbc.PgPreparedStatement.setClob(int, Reader, long) is not yet implemented
I saw that the method setValue of spring class org.springframework.jdbc.core.StatementCreatorUtils changed on latest versions and now it is not catching the exception SQLFeatureNotSupportedException and using a fallback method anymore, as it did on previous versions.
I've seen several answers related to workarounds when using JPA/Hibernate but it is not my case, the application does not use Hibernate at all.
What could I do to solve this issue? Any help is really appreciated.
Thanks,
Mariana
Is there a Database API specification for Java that is similar to what exists for Python (PEP249).
I'd like to make an application that can be used to connect to databases, universally, without worrying about the database engine type.
Yes, such an API exists and - AFAIK - it predates Python efforts at standardization. This specification and its API is called JDBC or Java DataBase Connectivity. The current version is JDBC 4.2 (with JDBC 4.3 currently in the pipeline), also identified as JSR 221: JDBCTM 4.0 API Specification maintenance release 2.
You can find the specification document at https://jcp.org/en/jsr/detail?id=221
The interfaces of the API are included in main Java API. See the packages java.sql and javax.sql.
See the Java Tutorial Trail: JDBC(TM) Database Access for an introduction.
A JDBC specification is tied to a Java version, so:
Java 9: JDBC 4.3
Java 8: JDBC 4.2
Java 7: JDBC 4.1
Java 6: JDBC 4.0
... earlier versions are not that interesting anymore
JDBC versions are generally additive, so features in earlier versions are carried over into newer version, and - bar some early mistakes - are usually not deprecated. Sometimes minor clarifications or semantic changes can be made in newer versions of the specification.
Be aware that features in newer JDBC versions are (usually) only accessible if the driver actually implements that JDBC version.
Disclosure: I am a member of the JDBC Expert Group
The database group recently upgraded the database to Oracle12c. I am currently using Hibernate 4.3.9. When I try to deploy the application, WebLogic throws an exception:
weblogic.application.ModuleException: org.hibernate.HibernateException: Unable to determine dialect to use [name=Oracle, majorVersion=12]; user must register resolver or explicitly set 'hibernate.dialect'.
HibernateUtil has
props.setProperty("hibernate.dialect", "utilities.OracleDialectExtended");
Where OracleDialectExtended extends Oracle10gDialect in order to register a Double as a float. HibernateUtil is being used to set the properties rather than in hibernate.cfg.xml.
Everything I have read indicates that using Oracle10gDialect should be OK. In fact, when I use the same set up in a batch type mode (not using WebLogic) I am able to connect with and work with Oracle without a problem.
Does anyone know how to resolve this? Or is this a WebLogic problem that needs to be addressed by a WebLogic admin.
Thanks.
Try with this:
props.setProperty("hibernate.dialect","org.hibernate.dialect.OracleDialect");
Just to follow up - in the end I upgraded Hibernate from 4.3.9 to 5.1.2 and things started working again.
Not the most ideal solution since a database upgrade shouldn't break an application but it was the fastest way to get things up and running again.
I am trying to Upgrade my Spring 1.9 Application to Spring 4 and therefore I also have to upgrade Hibernate. As database I am using Oracle.
When starting the application everything is fine until I am using Clobs, then the following Exception is thrown:
java.lang.AbstractMethodError:org.jboss.resource.adapter.jdbc.jdk5.WrappedPreparedStatementJDK5.setCharacterStream(ILjava/io/Reader;J)V
I also already upgradet my JDBC driver, does anyone have hint, what else to try?
The problem is the jboss-common-jdbc-wrapper.jar located under ${JBOSS_HOME}\common\lib obviously it was implemented against an Interface which was created in a version which is less then JDK_1.6. Therefore the method was never implemented though.
After replacing this Jar, with the same vom a JBoss AS 6.1 everything is working fine.
BR
I am trying to understand the difference between XA vs Non XA JDBC datasource. Also how do I know which type and version of JDBC dtriver is used. I am currently on 10.3 weblogic and trying some tet to kill long running queries using setQueryTimeout, which isnt seem to be reliable with OracleXADataSource as it is only working the first time and not always.
Sorry for this basic question but I am new to Weblogic Datasource configuration
Thanks
XA jdbc drivers are used to implement two-phase commit, meaning the two remote resources are part of the same transaction. Java specifies an implementation of this via JTA. A good reading is e.g. http://www.javaworld.com/javaworld/jw-07-2000/jw-0714-transaction.html; if you google for 'xa jdbc driver' you'll find plenty more info.
You should not use the XA driver if not necessary. I remember reading that there are some problems with them.
To identify JDBC driver your WLS is using, go to the <domain_dir>/config/jdbc and open the data souce file, check the driver-name value in the file.
To identify the Driver version, check from which .jar is the driver being loaded (run the WLS with -verbose:class)- the name of the jar will contain the version number. Also, you can use java -jar my-jdbc-file.jar which will print the driver version. The OJDBC drivers are usually stored in a file named ojdbc6.jar or ojdbc7.jar, etc.