1

Please, help me with the RowSetProvider, it throws an SQL exception

(No suitable driver found for jdbc:mysql://localhost:3306)

while Drivermanager.getConnection() works OK.

public static void main(String[] args) throws SQLException {

    Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/zoo?serverTimezone=UTC", "hbstudent",
            "hbstudent");
    System.out.println(con.getCatalog()); // <-- works OK

    // ****************************************************

    JdbcRowSet rs = RowSetProvider.newFactory().createJdbcRowSet();

    rs.setUrl("jdbc:mysql://localhost:3306/zoo?serverTimezone=UTC");
    rs.setUsername("hbstudent");
    rs.setPassword("hbstudent");
    rs.setCommand("select 1");
    rs.execute(); //<-- Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/zoo?serverTimezone=UTC

}
Pradnya Bolli
  • 1,915
  • 1
  • 19
  • 37

1 Answers1

0

I don't pretend to be introducing effective solution, but recently I faced very same problem with creating JdbcRowSet and CachedRowSet objects while using Java SE Development Kit 11.0.1 + MySQL Server 8.0.16 + Connector / J 8.0.16 driver.

After updating JDK for the latest version 12.0.1, the problem just disappeared.

P.S.

But be ready, after successfully creating JdbcRowSet object you might face another kind of problem while trying to update it. See "java.sql.SQLException: ResultSet is not updatable" with JdbcRowSet for details.

escudero380
  • 536
  • 2
  • 7
  • 25