2015-01-31 32 views
2

我有下面的代碼,我使用DriveManager來管理我的數據庫驅動程序。使用DriverManager.getConnection()不能找到符號

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

,但即時通訊具有.getConnection()錯誤,錯誤的是:

找不到符號

符號:類的getConnection

類: DriveManager

回答

5

getConnectionstatic方法。刪除new關鍵字

Connection con = DriverManager.getConnection("jdbc:hsqldb:hsql://localhost/first-example","SA",""); 
+0

它與您的解決方案一起工作。謝謝! – UserX 2015-01-31 21:28:04