Upgrade of JTOpen throws an error (No suitable driver)

241 views Asked by At

We are using Java applications with JDBC/JTOpen to AS400/IBM i DB2. Currently using JTOpen v.10.5 which works fine. Trying to upgrade to latest v.10.7 but it fails with:

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)

Same goes for v.10.6

Using a very simple test client:


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();
      } 
   }
}

I cannot see anything relevant in the changelog. Do you have any idea what is failing?

1

There are 1 answers

0
4integration On

Even though we are using Java 17, I tested with the one in java8/jt400.jar and that works fine. The main jar in root works if you add Class.forName...

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.