升级JTOpen会抛出一个错误(没有合适的驱动程序)



我们使用的Java应用程序带有JDBC/JTOpen到AS400/IBM i DB2。目前使用JTOpen v.10.5,运行良好。试图升级到最新的v.10.7,但失败了:

java.sql.SQLException: No suitable driver found for jdbc:as400://myserver.domain.net/MYDB;
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:706)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:229)
at TestMain.main(TestMain.java:14)

v.10.6 也是如此

使用一个非常简单的测试客户端:


import java.sql.*;
public class TestMain {
static final String DB_URL = "jdbc:as400://myserver.domain.net/MYDB;";
static final String USER = "myuser";
static final String PASS = "mypasswd";
static final String QUERY = "select * from MYTABLE";
public static void main(String[] args) {
try(Connection conn = DriverManager.getConnection(DB_URL, USER, PASS);
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(QUERY);) {
while (rs.next()) {
System.out.print("IRAVTNR: " + rs.getString("IRAVTNR"));
System.out.println(", IRISUF: " + rs.getInt("IRISUF"));
}
} catch (SQLException e) {
e.printStackTrace();
} 
}
}

我在变更日志中看不到任何相关内容。你知道什么失败了吗?

尽管我们使用的是Java 17,但我在java8/jt400.jar中测试了它,它运行良好。如果添加Class.forName...,根目录中的主jar就可以工作

Jar file          Contents
--------          --------
jt400.jar(*)         This is the main JTOpen jar file. It contains almost all open
source code (except for the few Toolbox classes that could
not be open-sourced), including the utilities package,
and the JDBC driver (JDBC 3.0).
java8/jt400.jar(*)   This is the main JTOpen jar file compiled for Java 8. 
A Java 8 JVM is required to use this class. 

相关内容

  • 没有找到相关文章

最新更新