在Spring 5中删除jdbc.support.nativejdbc的替代品 [英] replacement for jdbc.support.nativejdbc remove in Spring 5

查看:380
本文介绍了在Spring 5中删除jdbc.support.nativejdbc的替代品的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将项目升级到Spring 5,我注意到它不再具有org.springframework.jdbc.support.nativejdbc软件包.我们使用SimpleNativeJdbcExtractor提取本机JDBC Connection.当然,我可以简单地使用Spring 4中的源代码并将其嵌入到我的项目中,但是我更希望依赖一个完善的库.

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网站仅说软件包已被删除,没有提供其他选择.搜索Spring 5源代码不会产生任何结果.我想知道这里是否有人可以提出替代方案的建议.

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.

推荐答案

我假设您要访问本机java.sql.Connection的原因是,您要访问供应商连接类,因此可以访问供应商扩展.如果是这种情况,您可以简单地使用#unwrap(Class)例如

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);

这篇关于在Spring 5中删除jdbc.support.nativejdbc的替代品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆