db2的jdbc驱动

依照 JDBC 规范,有四种类型的 JDBC 驱动程序体系结构:

Type 1:这类驱动程序将 JDBC API 作为到另一个数据访问 API 的映射来实现,如开放式数据库连通性(Open Database Connectivity,ODBC)。这类驱动程序通常依赖本机库,这限制了其可移植性。JDBC-ODBC 桥驱动程序就是 Type 1 驱动程序的最常见的例子。
Type 2:这类驱动程序部分用 JAVA 编程语言编写,部分用本机代码编写。这些驱动程序使用特定于所连接数据源的本机客户端库。同样,由于使用本机代码,所以其可移植性受到限制。
Type 3:这类驱动程序使用纯 JAVA 客户机,并使用独立于数据库的协议与中间件服务器通信,然后中间件服务器将客户机请求传给数据源。
Type 4:这类驱动程序是纯 JAVA,实现针对特定数据源的网络协议。客户机直接连接至数据源。
对于DB2 UDB V7.2来说,它不支持 Type 1 和 Type 4 的驱动程序,但是提供了分别支持 Type 2 和 Type 3 的驱动程序。

目前DB2安装之后会自带两个驱动:

The IBM Data Server Driver for JDBC and SQLJ package includes two JDBC drivers:

  • db2jcc.jar - This driver is based on the JDBC 3 specification (Minimum required Java version 4)
  • db2jcc4.jar - This driver is based on the JDBC 4 or later specifications (Minimum required Java version 6)

如何查看jdbc驱动的版本号:

The following command will retrieve the JCC driver version if executed from the command line:

java com.ibm.db2.jcc.DB2Jcc -version

如果没有安装驱动的的查看jdbc驱动的版本命令:
Or for drivers that are not yet installed:

cd   <inst_path>/sqllib/java/

java -cp ./db2jcc.jar com.ibm.db2.jcc.DB2Jcc -version

java -cp ./db2jcc4.jar com.ibm.db2.jcc.DB2Jcc -version

db2jcc.jar和db2jcc4.jar的区别:

Answer

Both of them are DB2 JDBC driver jar files and are Type 4 drivers.

db2jcc.jar includes functions in the JDBC 3.0 and earlier specifications. If you plan to use those functions, include the db2jcc.jar in the application CLASSPATH.

db2jcc4.jar includes functions in JDBC 4.0 and later, as well as JDBC 3.0 and earlier specifications. If you plan to use those functions, include the db2jcc4.jar in the application CLASSPATH.

db2jcc.jar目前已经被弃用(deprecated, 但是仍然保留), 从DB2 11.1开始(jdbc3.72)开始将不再更新db2jcc.jar的新功能(仍存在),从DB211.5开始仅支持db2jcc4.jar,不再提供db2jcc.jar。

总之,db2jcc4.jar比db2jcc.jar更新更全面,安全性更好,且db2jcc4.jar包含db2jcc.jar的功能。因此建议使用db2jcc4.jar。

 

不同的db2版本对应相应的jdbc版本请参考:  https://www.ibm.com/support/pages/node/382667

 

参考文档:

https://blog.csdn.net/davidmeng10/article/details/49800765

https://blog.csdn.net/travisli4891/article/details/4526044?ops_request_misc=&request_id=&biz_id=102&utm_term=db2jcc%E5%92%8Cdb2jcc4%E6%9C%89%E4%BB%80%E4%B9%88%E5%8C%BA%E5%88%AB&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduweb~default-0-4526044

https://www.ibm.com/support/pages/difference-between-ibm-db2-jdbc-driver-files-db2jccjar-and-db2jcc4jar

 

 

 

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值