Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Java and Access

  • 11-02-2009 1:13pm
    #1
    Closed Accounts Posts: 22


    Looking to connect a java application with access 2007 anyone know which drivers to use and code??? Im trying to change the colour of the background in netbeans i tried right clicking and going into the properties but it doesnt do anyhting it just stays the same colour!


Comments

  • Registered Users, Registered Users 2 Posts: 1,456 ✭✭✭FSL


    When you say connect a Java application to Access 2007 do you mean you wish to modify an Access 2007 project or just manipulate the database?


  • Closed Accounts Posts: 22 shlen


    just mainipulate the database, read only functionality is all im looking to do!


  • Registered Users, Registered Users 2 Posts: 1,456 ✭✭✭FSL


    The ODBC driver for an Access 2007 database is ACEODBC.dll. It should conform to ODBC standards. I've never used it as I've only ever used Access for reports. I always use an SQL server for data.


  • Registered Users, Registered Users 2 Posts: 163 ✭✭stephenlane80


    you can do it in native java with the sun jdbc driver, this example is for 2003, you wil have to check the documentation to see what parameters 2007 needs:
    import java.sql.*;
    class Test
    
    
        {
        public static void main(String[] args)
    
    
            {
    
    
                try {
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                // set this to a MS Access DB you have on your machine
                String filename = "d:/java/mdbTEST.mdb";
                String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=";
                database+= filename.trim() + ";DriverID=22;READONLY=true}"; // add on to the end 
                // now we can get the connection from the DriverManager
                Connection con = DriverManager.getConnection( database ,"",""); 
            }
    
    
    
                catch (Exception e) {
                System.out.println("Error: " + e);
            }
    
        }
    
    }
    


Advertisement