Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

replacement for jdbc.support.nativejdbc remove in Spring 5

Tags:

java

spring

jdbc

I am upgrading my project to Spring 5 and I noticed that it no longer has org.springframework.jdbc.support.nativejdbc package. We use SimpleNativeJdbcExtractor to extract native JDBC Connection. Sure I simply can use source code from Spring 4 and embed it into my project however I'd prefer to rely on a well established library.

Spring Framework web site only says that the packages are removed and doesn't offer any alternatives. Search through Spring 5 source code yields nothing. I wonder if anyone here can offer a suggestion on what the alternatives could be.

like image 653
oᴉɹǝɥɔ Avatar asked Nov 20 '17 16:11

oᴉɹǝɥɔ


1 Answers

I assume the reason you want access to the native java.sql.Connection is because you want access to a vendor connection class so you have access to vendor extensions. If that is the case you can simply use #unwrap(Class) eg

OracleConnection oracleConnection = connection.unwrap(OraleConnection.class);
like image 130
Philippe Marschall Avatar answered Nov 15 '22 04:11

Philippe Marschall