我做了以下尝试使用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
}
}