南大通用GBase 8a数据库JDBC连接报错 Got packets out of order

GBase 8a 数据库集群,新版支持了sha256的用户密码加密,所以必须用对应的版本驱动。如果用来版本的,连接使用了sha256加密的用户,则会报Got packets out of order 错误。

报错样例

Exception in thread "main" com.gbase.jdbc.exceptions.jdbc4.GBaseNonTransientConnectionException: Got packets out of order
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at com.gbase.jdbc.Util.handleNewInstance(Unknown Source)
        at com.gbase.jdbc.Util.getInstance(Unknown Source)
        at com.gbase.jdbc.SQLError.createSQLException(Unknown Source)
        at com.gbase.jdbc.GBaseIO.c(Unknown Source)
        at com.gbase.jdbc.GBaseIO.a(Unknown Source)
        at com.gbase.jdbc.GBaseIO.a(Unknown Source)
        at com.gbase.jdbc.GBaseIO.a(Unknown Source)
        at com.gbase.jdbc.ConnectionImpl.execSQL(Unknown Source)
        at com.gbase.jdbc.ConnectionImpl.execSQL(Unknown Source)
        at com.gbase.jdbc.StatementImpl.executeQuery(Unknown Source)
        at com.gbase.jdbc.ConnectionImpl.q(Unknown Source)
        at com.gbase.jdbc.ConnectionImpl.n(Unknown Source)
        at com.gbase.jdbc.ConnectionImpl.b(Unknown Source)
        at com.gbase.jdbc.ConnectionImpl.createNewIO(Unknown Source)
        at com.gbase.jdbc.ConnectionImpl.<init>(Unknown Source)
        at com.gbase.jdbc.JDBC4Connection.<init>(Unknown Source)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at com.gbase.jdbc.Util.handleNewInstance(Unknown Source)
        at com.gbase.jdbc.ConnectionImpl.a(Unknown Source)
        at com.gbase.jdbc.NonRegisteringDriver.a(Unknown Source)
        at com.gbase.jdbc.NonRegisteringDriver.connect(Unknown Source)
        at java.sql.DriverManager.getConnection(DriverManager.java:664)
        at java.sql.DriverManager.getConnection(DriverManager.java:270)
        at Test.main(Test.java:11)

解决方案

更换新的支持sha256的jdbc驱动版本

[root@localhost gbase]# /usr/java/jdk1.8.0_271-amd64/bin/java -cp .:./gbase-connector-java-8.3.81.53-build55.5.7-bin_min_mix.jar Test
[root@localhost gbase]#

参考