How do I connect to an Access database over a local network using Java?

Do you know of any good tutorials on how to access an Access database using Java?

I know the basics and basic SQL, but I'm thinking more about access control.

0


a source to share


4 answers


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, "", "");
    }  

      

Some useful links:



+4


a source


If you mean using relational databases in Java, you need to know JDBC .



You can't do much with security using JDBC. You will need to create it in your application using something like JAAS or Spring Security .

0


a source


You can share the database through a shared drive in LAN n, and then add it to the system DSN on other PCs, and you can share the available database over the LAN. It worked for me

I know the string is out of date, but maybe useful for someone like me, I was disappointed to find a suitable and easy way to exchange

0


a source


JDBC is the way to go. Google for "JDBC tutorial" + mysql, you get everything you need.

-2


a source







All Articles