-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Setting transactionIsolation level in HikariCP configuration #135
Comments
Ah, this one is tricky. This issue is caused by the signatures of the HikariConfig class: public int getTransactionIsolation() {
return transactionIsolation;
}
public void setTransactionIsolation(String isolationLevel) {
this.transactionIsolationName = isolationLevel;
} These methods do not follow typical bean signatures, where I'll fix the code, but in the meantime can you try forcing the type, like so? <property name="transactionIsolation">
<value="TRANSACTION_READ_COMMITTED" type="java.lang.String"/>
</property> |
A fix has been committed. You can build and test it if you like, or use the "force" method above. The fix will appear in the next release of HikariCP (2.1.0). |
Thank you Brett, But unfortunately, type forcing does not work. You say "A fix has been committed. You can build and test it if you like" and then "The fix will appear in the next release of HikariCP (2.1.0)."; what does this actually mean, I am using 2.0.1 - is the fix available here or I shd wait for 2.1.0 release and when is this release available. Thanks and regards, |
The next 2.1.0 release may be available next week. If you want to use it before that, you can build it like this:
You can then use if you want to continue using 2.0.1, as a further workaround you can put the pool properties in a separate properties file and use Spring to construct a HikariConfig using that file, and a HikariDataSource bean using the HikariConfig. Incidentally, |
Thanks Brett, I am actually in the middle of trying out HikariCp for an application that is currently using DBCP. The transaction related issue that I had for which I wanted to set transactionIsolation level on HikariCP got resolved by setting autoCommit to true. Currently I am running clean install and trying to get it successfully done with all the testcases passing. But what I see now is a lot of time out exceptions as shown below, [JdbcServicesImpl| WARN|14:47:21,619] HHH000342: Could not obtain connection to query metadata : Timeout of 30000ms encountered waiting for connection. - (logged at Thread(main):org.hibernate.engine.jdbc.internal.JdbcServicesImpl:169)
I also see a lot of these
are they related? and in an other post I see that for this issue above you suggested upgrading to Hibernate 4.3.2 - would this resolve the time outs as well? BTW i tried increasing Oracle processes to solve the "ORA-12519, TNS:no appropriate service handler found" - but that didnt help. Please note that with DBCP clean install was successful with no such errors. Thanks and regards, |
Oh, I didn't realize this was Hibernate deployment. In that case, I strongly recommend you use Hibernate 4.3.6. Hibernate officially added support for HikariCP in that release. I also recommend using the Hibernate provided HikariCPConnectionProvider to create connections by setting the Finally, I recommend enabling debug logging for HikariCP so you can easily collect information on the pool size (active, idle, waiting). EDIT: Make sure the maxPoolSize in HikariCP is set to the same as it was in DBCP. |
I upgraded to hibernate 4.3.6, but now I get java.sql.SQLException: ORA-01017: invalid username/password; logon denied, with the same settings that worked before with 4.2.8. I am pasting the contents of my configuration file, could you please let me know what is missing?
|
Try adding |
Enabling debug helped identify invalid connection parameter to one of the datasources. The clean install was running smoothly till some point and then it started failing with the same exception as before: [HikariPool|DEBUG|14:05:17,759] Before cleanup pool stats HikariPool-32 (total=10, inUse=0, avail=10, waiting=0) - (logged at Thread(Hikari Housekeeping Timer (pool HikariPool-32)):com.zaxxer.hikari.pool.HikariPool:542)
It looks like either something is wrong with the application or the testcases themselves, that so many connection pools get created. Any thoughts? |
You need to make sure to shutdown the HikariDataSource at the end of each test, using either the Take a look at the |
Thanks Brett, after some tuning of the connection pool parameters clean install was successful. |
Can you please let me know how can we setup the CallableStatement into cache.
what should be the parameter to setup the Callable statement caching in config object. |
Hello,
I have the following configuration
for which I get the exception given below:
Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'int' for property 'transactionIsolation'; nested exception is java.lang.NumberFormatException: For input string: "TRANSACTION_READ_COMMITTED"
so i tried this:
And this still throws an exception as shown below
Property 'transactionIsolation' threw exception; nested exception is java.lang.IllegalArgumentException: argument type mismatch
Can someone pls help. Thanks in advance, Priya
The text was updated successfully, but these errors were encountered: