Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is it Hibernate, PostgreSQL, or Spring Boot: Unexpected error trying to gauge level of JDBC REF_CURSOR support : null

When using the PostgreSQL JDBC driver in my project i get a weird error stating "Unexpected error trying to gauge level of JDBC REF_CURSOR support : null"

It causes my application to hang when starting up for anywhere between eighty to three hundred seconds. After startup everything works fine. I am using the following driver version:

(Gradle Dependency style) 'org.postgresql:postgresql:9.3-1102-jdbc41'

My application is a Spring Boot application and the hanging happens upon starting that application.

I saw the error after turning on Hibernate logging. The full log is at the following paste.

http://pastebin.com/CAjSyQw9

After it hits the last line of the log in that paste then the application hangs for eighty to three hundred seconds, usually for about 100 seconds on average. The application still starts up fine and works as expected.

Does this sort of an error seem like an issue with the JDBC driver?

There is a similar SO question on this topic here.

Edit 1:

It looks like something really weird is happening on lines 69 and 70 of my paste bin paste. It looks like my specified dialect of org.postgresql.Dialect is being changed to some MySQL thing.

[org.hibernate.dialect.Dialect] : [MySQL5] -> [org.hibernate.dialect.MySQL5Dialect] (replacing [org.hibernate.dialect.MySQL5Dialect])
2014-10-16 08:05:50.561 DEBUG 36916 --- [ost-startStop-1] o.h.b.r.s.internal.StrategySelectorImpl  : Registering named strategy selector [org.hibernate.dialect.Dialect] : [MySQL5InnoDB] -> [org.hibernate.dialect.MySQL5InnoDBDialect] (replacing [org.hibernate.dialect.MySQL5InnoDBDialect])
like image 993
Kent Bull Avatar asked Dec 26 '22 03:12

Kent Bull


1 Answers

I had the same issue. I fixed it ...er... worked around it, by adding the System property defined in the answer here.

It is something to do with how Hibernate and Postgresql looks up the database metadata. If there are a lot of datatypes in the database, the process can take a long time as each data type requires a SQL roundtrip for the information. The System property defined below circumvents the whole metadata retrieval and uses the Hibernate defaults for Postgresql.

-Dhibernate.temp.use_jdbc_metadata_defaults=false

Hope this helps someone else.

like image 196
gjrwebber Avatar answered Dec 30 '22 12:12

gjrwebber