我是Java
网络方面的新手。由于某种原因,我的java
文件无法连接到localhost
数据库。我不断收到错误消息。请帮助
test.java:
import java.sql.*;
class test {
public static void main(String[] args) {
try {
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/user", "root", "");
} catch(Exception exp) {
exp.printStackTrace();
}
}
}
error:
java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost/user
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at test.main(test.java:7)
directory: