我按如下方式配置连接池:
dataSource = new BasicDataSource();
dataSource.setUrl("jdbc:sap://********:30015");
dataSource.setDriverClassName("com.sap.db.jdbc.Driver");
dataSource.setMaxActive(20);
dataSource.setMaxIdle(0);
dataSource.setMaxIdle(0);
dataSource.setUsername("*******");
dataSource.setPassword("*******");
但是,当连接初始化时,我得到了这个例外:
java.lang.ArrayIndexOutOfBoundsException: 10
at com.sap.db.util.StructuredBytes.putBigUnicode(StructuredBytes.java:568)
at com.sap.db.util.MemIndirection.putBigUnicode(MemIndirection.java:186)
at com.sap.db.jdbc.packet.DataPartAuthentication.putBigUnicode(DataPartAuthentication.java:192)
at com.sap.db.util.security.AuthenticationManager.addClientProofPart(AuthenticationManager.java:139)
at com.sap.db.util.security.AbstractAuthenticationManager.connect(AbstractAuthenticationManager.java:39)
at com.sap.db.jdbc.ConnectionSapDB.openSession(ConnectionSapDB.java:586)
at com.sap.db.jdbc.ConnectionSapDB.doConnect(ConnectionSapDB.java:436)
at com.sap.db.jdbc.ConnectionSapDB.<init>(ConnectionSapDB.java:195)
at com.sap.db.jdbc.ConnectionSapDBFinalize.<init>(ConnectionSapDBFinalize.java:13)
at com.sap.db.jdbc.Driver.connect(Driver.java:255)
at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)
at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556)
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
正如您所看到的,SAP HANA JDBC驱动程序代码中存在异常,而不是我的代码。但我也不明白在这种情况下我可能做错了什么?
非常感谢任何有关如何调试此操作的帮助和建议。
答案 0 :(得分:1)
根据对AuthenticationManager的堆栈跟踪引用来判断,您的用户名和密码是否正确? stacktrace上的方法名称putBigUnicode让我觉得可能有一些无效的字符,比如“在那里