package bean;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class DbConnect {
public static Connection connection;
public static Connection getConnection() {
try {
Class.forName(“com.mysql.jdbc.Driver”);
connection = DriverManager.getConnection(“jdbc:mysql://localhost:3306/test”,“root”, “root”);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}catch (Exception e) {
System.out.println(“数据库连接失败”);
e.printStackTrace();
}
return connection;
}
}
哪里有错误吗,运行404