问题描述
- 连接DM数据库报错,在线等
-
错误信息:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 374454154
at dm.jdbc.dbaccess.DmMsg.getInt(DmMsg.java:155)
at dm.jdbc.driver.DmdbCSI._$8394(DmdbCSI.java:248)
at dm.jdbc.driver.DmdbCSI.(DmdbCSI.java:121)
at dm.jdbc.driver.DmdbConnection.(DmdbConnection.java:527)
at dm.jdbc.driver.DmDriver.connect(DmDriver.java:103)
at java.sql.DriverManager.getConnection(DriverManager.java:525)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at test.Test.main(Test.java:30)
代码:
String driver= "dm.jdbc.driver.DmDriver";
String url= "jdbc:dm://LOCALHOST:5236/SYSTEM";
String username="SYSDBA";
String password="123456789";
Connection conn = null;
try {
System.out.println("注册驱动中。。。");
Class.forName(driver);
System.out.println("注册驱动成功!");
System.out.println("连接数据库。。。。");
conn = DriverManager.getConnection(url, username, password);
System.out.println("连接数据库成功!");
} catch (SQLException e) {
e.printStackTrace();
System.out.println("连接数据库失败!");
} catch (ClassNotFoundException e) {
System.out.println("注册驱动失败!");
e.printStackTrace();
} finally {
if(conn != null){
try {
conn.close();
} catch (SQLException e) {
System.out.println("关闭数据库连接失败!");
e.printStackTrace();
}
}
}
解决方案
索引越界了,getInt取不到自定索引字段的值
时间: 2024-11-03 00:38:20