I am a student and we are working on a project in Access database but in windows.
When I go back home I tried to run and edit the project but it didn't work. Notice that I don't have Access installed on my mac.
My questions:
1- do I have to install Access on my mac?
2- If not why do I have this error?

package DB;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

public class empQueries {
    
    private static String URL = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=/Users/Home/Desktop/My Tools/DB + proj/HR.mdb";
    private static String userName =""; //Access no neeed for username or password
    private static String Password ="";
    
    private Connection Con = null;
    private PreparedStatement selectAllStatement = null;
    private PreparedStatement insertNewPerson = null;
    private PreparedStatement updatePerson = null;
    private PreparedStatement deletePerson = null;
    
    public empQueries()
    {
        try {
         
            Con = DriverManager.getConnection(URL);
            System.out.print("Success");
        } catch (SQLException ex) {
            System.out.print("not Success");;
        }
    }
    public static void main(String [] args)
    {
        empQueries Test = new empQueries();
    }
    
}

Thanks.

I forgot to mention that I tried this on Netbeans and eclipse.

> do I have to install Access on my mac
You need the ODBC driver for Access. There are third-party vendors that sell them, though I'm not sure if there are any free options available to you.

Maybe you could switch to JavaDB or H2 instead?

Well as my knowledge Java has Access drivers installed already, or this is for windows only? Or I'm wrong?

No, Java has no drivers for Access. You are currently using the JDBC/ODBC bridge driver, which allows JDBC connection through a separately installed ODBC driver.

Read the docs or forums I suppose. I have no idea if that will allow you to use the Access ODBC driver. Maybe their FAQ will help?

I'll just reiterate my suggestion to use a different database if you want to work on Mac.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.