【发布时间】:2013-12-14 20:29:45
【问题描述】:
我正在使用 putty 编写一个接受 SQL 的 Java 程序,但是我收到了这个错误:
没有找到适合 jdbc:mysql://localhost:3306/Chinook 的驱动
我不确定出了什么问题。
这是我的代码:
import java.sql.*;
import java.io.IOException;
public class Q1{
public static void main (String args[]) throws IOException {
Connection conn=null;
String driver="com.mysql.jdbc.Driver";
String url="jdbc:mysql://localhost:3306/Chinook";
System.setProperty(driver,"");
try{
conn = DriverManager.getConnection(url,"username","password");
System.out.println("Connected to the DB");
}
catch (SQLException ex){
System.out.println("SQLException:"+ ex.getMessage());
}
}
}
【问题讨论】:
-
您的计算机上正在运行 MySQL 服务器吗?