【发布时间】:2021-12-27 02:19:17
【问题描述】:
我们的项目在服务器上有一个数据库。
当我运行程序时,它工作得很好。我可以登录并注册另一个帐户。
但是当我的同学运行代码时,他得到了一个异常:No suitable driver found for jdbc:mysql://ServerIp//DBName
我的代码如下所示:
String hostURL = "jdbc:mysql://ServerIp:3306/Database"; //There's an actual ip of course
Connection con = DriverManager.getConnection(hostURL, "username", "password");
System.out.println("Connected successfully");
我们已经将 mysql-connector 添加到依赖项 (IntelliJ) 中,但它根本没有帮助。
此外,我什至不需要添加它,该项目对我来说工作得很好,根本不需要做任何事情。该项目位于 Java Enterprise -> Web 应用程序中
【问题讨论】: