No suitable driver found for jdbc mysql?

后端 未结 6 1406
抹茶落季
抹茶落季 2020-12-03 23:28

I am trying to write a program to connect to a MySQL database in eclipse, but I get the error \"java.sql.SQLException: No suitable driver found\".

The java

6条回答
  •  日久生厌
    2020-12-03 23:36

    Load Driver class just before getting the connection.

    Use this code:

    Class.forName("com.mysql.jdbc.Driver");
    con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test_db", "user", "passw");
    

提交回复
热议问题