I teach a very introductory Java class to vocational HS students. I have been trying to connect a simple Java project to a simple MS Access database, with 0 positive results.
I have created an MS Access database with four fields: ID (autonumber), Site (text), User (text), PW (text). I have populated with 4 simple records ("Adam", "Beth", "Chad", "Dana" for site, user, and pw). The database is saved in the root of the Java project folder.
I have tried a number of searches and results but cannot get the Java to connect. I get this error message: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
Can anyone tell me what I'm missing? Or maybe point me to a working example? Thanks, Mike
Oh, yeah, here's my current code:
// Global Class Variables
String filePathString = "C:\\Users\\mclarke\\Documents\\NetBeansProjects\\PasswordManager.accdb";
String strConnect = "jdbc:odbc:DRIVER=Microsoft Access Driver (*.mdb, *.accdb);DBQ=" + filePathString;
// GUI initComponents()
public PasswordManagerGUI() {
    initComponents();
    try {
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        Connection con = DriverManager.getConnection(strConnect, "","");
        System.out.println("Connection Succesfull");
    } catch (Exception e) {
        System.err.println("Got an exception! ");
        System.err.println(e.getMessage());
    }
}
// Main()
public static void main(String args[]) {
    try {
        for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                javax.swing.UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (ClassNotFoundException ex){
    } catch (InstantiationException ex) {
    } catch (IllegalAccessException ex) {
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
    }
    java.awt.EventQueue.invokeLater(new Runnable() {
        public void run() {
            new PasswordManagerGUI().setVisible(true);
        }
    });
}
