Results 1 to 6 of 6
  1. #1
    newbiejava is offline Senior Member
    Join Date
    Jan 2010
    Posts
    138
    Rep Power
    0

    Question accessing ms. access

    Dear All.

    I want to open read & write ms. access in Linux & Windows Environment..
    could any body please advise.. where can I download free version of Ms. Access JDBC ?

    TIA

  2. #2
    wsaryada is offline Senior Member
    Join Date
    Jun 2007
    Location
    Bali, Indonesia
    Posts
    762
    Rep Power
    10

    Default

    Hello,

    You can use the Sun JDBC ODBC Driver (sun.jdbc.odbc.JdbcOdbcDriver) to access and manipulate the Microsoft Access database.

  3. #3
    newbiejava is offline Senior Member
    Join Date
    Jan 2010
    Posts
    138
    Rep Power
    0

    Default

    Hi thanks,

    could you please give me a simple example for opening Ms. Access DB?

    currently, I am trying to use Jackless (Jackcess - Java Library for MS Access) .. but facing problem

    TIA

  4. #4
    wsaryada is offline Senior Member
    Join Date
    Jun 2007
    Location
    Bali, Indonesia
    Posts
    762
    Rep Power
    10

    Default

    Hello,

    Here is an example that I have for opening connection to MS Access database:

    Java Code:
    package org.kodejava.example.sql;
    
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import java.sql.PreparedStatement;
    
    public class MSAccessConnect {
        //
        // If you want to use you ODBC DSN
        //
        //private static final String URL = "jdbc:odbc:TestDB";
    
        private static final String USERNAME = "admin";
        private static final String PASSWORD = "welcome";
        private static final String DRIVER = "sun.jdbc.odbc.JdbcOdbcDriver";
    
        private static final String URL =
            "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=D:\\Database\\testdb.mdb;}";
    
        public static void main(String[] args) throws Exception {
            Connection connection = null;
            try {
                Class.forName(DRIVER);
                connection = DriverManager.getConnection(URL, USERNAME, PASSWORD);
    
                //
                // Do something with the connection here!
                //
            } catch (SQLException e) {
                e.printStackTrace();
            } finally {
                connection.close();
            }
        }
    }
    The code is taken from How do I create a connection to MS Access database?

  5. #5
    newbiejava is offline Senior Member
    Join Date
    Jan 2010
    Posts
    138
    Rep Power
    0

    Default

    ok, I understood now.. so I should create DSN..
    does the codes also compatible on Linux? ..

  6. #6
    newbiejava is offline Senior Member
    Join Date
    Jan 2010
    Posts
    138
    Rep Power
    0

Similar Threads

  1. Replies: 3
    Last Post: 12-01-2011, 07:40 AM
  2. Default Access (package access) confusion
    By gauravrajbehl in forum New To Java
    Replies: 1
    Last Post: 11-18-2009, 11:48 AM
  3. Accessing MS Access using DSN less connection
    By Java Tip in forum Java Tip
    Replies: 1
    Last Post: 03-31-2009, 05:25 PM
  4. Method access or field access
    By carderne in forum New To Java
    Replies: 2
    Last Post: 12-06-2008, 07:20 PM
  5. Replies: 1
    Last Post: 08-07-2007, 07:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •