我无法找到com.mysql.jdbc.Driver类(我已通过使用Eclipse构建路径将mysql-connector-java-5.1.47.jar添加到我的路径中)

时间:2019-06-17 20:16:16

标签: java mysql jdbc

我做了以下尝试使用jdbc的步骤: 1)下载mysql连接器,并将mysql-connector-java-5.1.47.jar复制到我的项目文件夹中。 2)使用Eclipse build path选项将相同的jar添加到classpath。 3)编写以下代码:

import java.sql.*;


class Solution{
    public static void main(String[] args){

        Connection con; // The JDBC provided connection object.

        Class.forName(“com.mysql.jdbc.Driver”).newInstance(); // Error - com.mysql.jdbc.Driver cannot be resolved to a variable

    }
}

enter image description here

0 个答案:

没有答案