0

I'm using Type 5 DataDirect JDBC Drivers in my program, but when I run this program then I get an exception:

java.sql.SQLException: No suitable driver found for jdbc:datadirect:mysql://localhost:3306/jmysql?useSSL=false.

public class Type5DataDirectDriver {

public static void main(String[] args) {
    Connection con = null;
    // Establish the Connection
    try {
        con = DriverManager.getConnection("jdbc:datadirect:mysql://localhost:3306/jmysql?useSSL=false", "root", "");

        // Verify the Connection
        DatabaseMetaData metaData = con.getMetaData();
        System.out.println("Driver Name: " + metaData.getDriverName());
        System.out.println("Driver Version: " + metaData.getDriverVersion());
        System.out.println("Database Name: " + metaData.getDatabaseProductName());
        System.out.println("Database Version: " + metaData.getDatabaseProductVersion());

    } catch(SQLException ex) {
        ex.printStackTrace();
    }
    finally {
        try {
            if (con != null) {
                con.close();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
}

ExceptionL

java.sql.SQLException: No suitable driver found for jdbc:datadirect:mysql://localhost:3306/jmysql?useSSL=false
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:703)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:229)
at java9.Type_3MiddlewareDriver.main(Type5DataDirectDriver.java:14)
Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Ng Sharma
  • 2,072
  • 8
  • 27
  • 49
  • This means you either don't have the JDBC driver on your class path, or the URL you use is wrong. Please show the commandline you use to start Java. – Mark Rotteveel Mar 16 '18 at 13:09
  • There is no such thing as a "Type 5" driver. JDBC only specifies 4 types: http://www.oracle.com/technetwork/java/overview-141217.html#2 –  Mar 16 '18 at 13:10
  • Tpye 5 driver is unofficial Driver. – Ng Sharma Mar 16 '18 at 13:11
  • @a_horse_with_no_name This is marketing bullshit from Datadirect (Progress), they actually call there driver Type 5 (and have in the past even defaced several resources on the internet, including the Wikipedia page on JDBC to claim it was an 'official' JDBC type). – Mark Rotteveel Mar 16 '18 at 13:12
  • @Mark Rotteveel i do'not understand what is show the commandline. – Ng Sharma Mar 16 '18 at 13:22
  • The commandline you use to start your application (and if you don't use the commandline, then clearly describe how you are running it and how you have setup the class path). – Mark Rotteveel Mar 16 '18 at 13:22
  • before I'm installing the Mysql JDBC driver (https://www.progress.com/jdbc/mysql), after installing set the classpath environment of mysql.jar file. C:\Program Files\Progress\DataDirect\Connect_for_JDBC_51\lib\mysql.jar @Mark Rotteveel – Ng Sharma Mar 16 '18 at 13:33
  • That is not specific enough, which class path are you setting, and where. For example most ways of using Java do not use the `CLASSPATH` environment variable, so setting that usually has no effect whatsoever. – Mark Rotteveel Mar 16 '18 at 16:13

0 Answers0