2009-05-26 101 views

回答

4
private static final String accessDBURLPrefix = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ="; 
    private static final String accessDBURLSuffix = ";DriverID=22;READONLY=false}"; 

    // Initialize the JdbcOdbc Bridge Driver 
    static { 
     try { 
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); 
     } catch(ClassNotFoundException e) { 
      System.err.println("JdbcOdbc Bridge Driver not found!"); 
     } 
    } 

    /** Creates a Connection to a Access Database */ 
    public static Connection getAccessDBConnection(String filename) throws SQLException { 
     filename = filename.replace('', '/').trim(); 
     String databaseURL = accessDBURLPrefix + filename + accessDBURLSuffix; 
     return DriverManager.getConnection(databaseURL, "", ""); 
    } 

一些有用的鏈接:

-2

JDBC是要走的路。谷歌的「JDBC教程」+ MySQL,你會得到你所需要的。

+0

你顯然沒有讀過這個問題。我知道如何使用谷歌。謝謝。 – Relequestual 2009-05-26 09:35:16

+0

恰恰相反,我的確看過這個問題。我只是給你正確的條件去尋找。知道你想要什麼是最好的,但是不知道(現在)是不知道的。 – jrharshath 2009-05-26 09:38:38

0

如果你的意思是在Java中使用關係型數據庫,你需要知道JDBC

對於使用JDBC的安全性,您將無能爲力。您必須使用類似JAASSpring Security的應用程序將其構建到應用程序中。

0

您可以通過局域網共享驅動器共享一個數據庫N,然後將其添加到系統DSN其他電腦,您可以通過局域網共享訪問數據庫..爲我工作一樣,

我知道字符串是舊的,但也許對像我這樣的人有用我很沮喪找到一個適當和簡單的方式共享

相關問題