title: Java connection to MS Access Database
body: <p>Just wondering if anyone cane help me, I'm trying to connect to an MS Access Database. I have done it on other projects and used exactly the same code. Can anyone see if I have done anything wrong?</p>
  
  <pre><code>try {
          System.out.println("Attempting Database Connection");
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
          String sourceURL = "jdbc:odbc:Driver={Microsoft Access Driver(*.mdb)};DBQ=MotivationDatabase.mdb;";
          connection = DriverManager.getConnection(sourceURL, "", "");
          stmt = connection.createStatement();
          System.out.println("Connection made");
      } catch (Exception e) {
          System.out.println("Database connection attempt failed");
          System.out.println(e);
      }
  </code></pre>
  
  <p>I keep getting the error:</p>
  
  <pre><code>java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Could not find file '(unknown)'.
  </code></pre>
  
  <p>But my database is in the same folder as my project like I've done before s I'm not sure why i am getting this error. Help?</p>