-
Notifications
You must be signed in to change notification settings - Fork 63
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
Unwrap Oracle connection if it can #157
Unwrap Oracle connection if it can #157
Conversation
if (con.isWrapperFor(ORACLE_CONNECTION_INTERFACE)) { | ||
return (Connection) con.unwrap(ORACLE_CONNECTION_INTERFACE); | ||
} | ||
} catch (SQLException e1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EmptyCatch: Caught exceptions should not be ignored
ℹ️ Expand to see all @sonatype-lift commands
You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Command | Usage |
---|---|
@sonatype-lift ignore |
Leave out the above finding from this PR |
@sonatype-lift ignoreall |
Leave out all the existing findings from this PR |
@sonatype-lift exclude <file|issue|path|tool> |
Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file |
Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.
Why not writing your own implementation and use that? I had the same problem concerning HikariCP. Here is my solution: First I wrote a ConnectionFinder:
Important is the NoArgs Constructor. In Hibernate configuration I added it as a property:
|
I'm using Quarkus. To use your own implementation of a ConnectionFinder in Quarkus you need to add to your application.properties: Because you're now using unsupported properties, you get a big warning from Quarkus every time you start up your application. |
I see. Did not know that. Thx for explaining me this. |
The code is sufficiently general and doesn't introduce additional dependencies so I have no problem merging this. Thanks for the PR! |
In my application I have a
io.agroal.pool.wrapper.ConnectionWrapper
which wraps an Oracle connection. TheDefaultConnectionFinder
can't find the Oracle connection because the wrapper doesn't have a getter that returns the Oracle connection. It does however have theunwrap()
method which return the Oracle connection. So try to use that before falling back on reflection.