'No suitable driver found for jdbc by Java 9.0.4 and Derby 10.14.2.0 and Maven

I'm trying to solve the problem with connection to Derby since a few days. I have always the same Exception:

    java.sql.SQLException: No suitable driver found for jdbc:derby://jdbc:derby:/Users/apolit/MyDB/DerbyDatenbank;create=true/
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:703)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:252)
at InsertApp.main(InsertApp.java:19)

Printscreen from my view
Printscreen from my view

I have at first instaled Derby.jar in the Java Build Path. it did not work, then changed to Maven and always is the problem with the Exception and no suitable driver...

I have already tried to change to Java 12 but there is the same problem. I'm doing something wrong. I'm using Eclipse 4.12.0 on the MacOS Mojave.

I'm thinking about the change to Netbeans to see maybe the problem is with Eclipse?

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Properties;


public class InsertApp {

public static void main(String[] args) {
     
    try {
        // connect method #1 - embedded driver
        String dbURL1 = "jdbc:derby://jdbc:derby:/Users/apolit/MyDB/DerbyDatenbank;create=true/";
        Connection conn1 = DriverManager.getConnection(dbURL1);
        if (conn1 != null) {
            System.out.println("Connected to database #1");
        }
         
        // connect method #2 - network client driver
        String dbURL2 = "jdbc:derby://localhost/DerbyDatenbank;create=true";
        String user = "test";
        String password = "test";
        Connection conn2 = DriverManager.getConnection(dbURL2, user, password);
        if (conn2 != null) {
            System.out.println("Connected to database #2");
        }

        // connect method #3 - network client driver
        String dbURL3 = "jdbc:derby://localhost/DerbyDatenbank";
        Properties properties = new Properties();
        properties.put("create", "true");
        properties.put("user", "test");
        properties.put("password", "test");
         
        Connection conn3 = DriverManager.getConnection(dbURL3, properties);
        if (conn3 != null) {
            System.out.println("Connected to database #3");
        }
    } catch (SQLException ex) {
        ex.printStackTrace();
    }
}
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source