我们正在使用JDBC/JTOpen到are 400/IBM DB2的Java应用程序。目前使用的是JTOpen v.10.5,运行良好。试图升级到最新版本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)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();
}
}
}我看不出任何与变化有关的东西。你知道什么是失败吗?
发布于 2022-04-08 12:25:53
尽管我们使用的是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. https://stackoverflow.com/questions/71779094
复制相似问题