在代码中同时添加了sqlserver2008
与sqlserver2000
jdbc的jar包,并且生成了2个连接池对象,每个连接池对象都设置了不同的DriverClass,但是启动的时候依然提示以下错误
2016-7-28 16:02:16 com.microsoft.sqlserver.jdbc.SQLServerConnection Prelogin
警告: ConnectionID:5 ClientConnectionId: 88e86cb1-2464-4d23-be03-9beec06a5e2d Server major version:8 is not supported by this driver.
sqlserver2000
依旧使用更高级别的DriverClass加载,如何才能做到同时加载2种不同版本的sqlserver的DriverClass
巴扎黑2017-04-18 09:41:17
Is it java? Are you using spring? If you want to use different jar packages, you actually want to connect to two different databases at the same time, right? If it is spring, please configure two data sources with different names and use them separately
PHP中文网2017-04-18 09:41:17
The question here is related to the class loading mechanism, which is generally JDBC
的驱动都是会用 Class.forName("包名.类名")
进行加载,如果两个版本的 JDBC
驱动的包名和类名是一样的,那只能加载其中一个 DriverClass
.
It’s very simple to understand this, then just change different package names