I am trying the following code to make connection with my database online, hosted on ElephantSQL.
private static Connection getConnection() {
        try {
            Class.forName("org.postgresql.Driver");
        }
        catch (ClassNotFoundException e) {
            System.out.println("Jar not found "+e.getMessage());
        }
        //dbUrl is given this way
        String dbUrl = "jdbc:postgres://database:password@manny.db.elephantsql.com:5432/database";
        String username = "database";
        String password = "password";
        try {
            return DriverManager.getConnection(dbUrl,username,password);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }
But I am getting the following error:
java.sql.SQLException: No suitable driver found for < url >
I tried all the things from the similar questions which I found here Question 1 and Question 2.
But nothing worked and I am stuck. I would appreciate any help.
 
     
    