使用DriverManager.getConnection()找不到符号

时间:2015-01-31 20:44:06

标签: java jdbc

我在下面有这个代码,我使用DriveManager来管理我的数据库驱动程序。

public static void main(String[] args)throws SQLException  {
            Connection con = new DriverManager.getConnection("jdbc:hsqldb:hsql://localhost/first-example","SA","");
        }

但我与.getConnection()有错,错误是:

无法找到符号

符号:类getConnection

类: DriveManager

1 个答案:

答案 0 :(得分:5)

getConnection是一种static方法。删除new关键字

Connection con = DriverManager.getConnection("jdbc:hsqldb:hsql://localhost/first-example","SA","");
相关问题