无法使用 DriverManager.getConnection() 找到符号
Cannot find symbol using DriverManager.getConnection()
我在下面有这段代码,我在其中使用 DriveManager 来管理我的数据库驱动程序。
public static void main(String[] args)throws SQLException {
Connection con = new DriverManager.getConnection("jdbc:hsqldb:hsql://localhost/first-example","SA","");
}
但是我在使用 .getConnection()
时出错了,错误是:
找不到符号
符号: class getConnection
class: DriveManager
getConnection
是一种 static
方法。删除 new
关键字
Connection con = DriverManager.getConnection("jdbc:hsqldb:hsql://localhost/first-example","SA","");
我在下面有这段代码,我在其中使用 DriveManager 来管理我的数据库驱动程序。
public static void main(String[] args)throws SQLException {
Connection con = new DriverManager.getConnection("jdbc:hsqldb:hsql://localhost/first-example","SA","");
}
但是我在使用 .getConnection()
时出错了,错误是:
找不到符号
符号: class getConnection
class: DriveManager
getConnection
是一种 static
方法。删除 new
关键字
Connection con = DriverManager.getConnection("jdbc:hsqldb:hsql://localhost/first-example","SA","");