title: "System resource exceeded" during connection to Access file through Java jdbc odbc
body: <p>I've read all "System resource exceeded" posts, but this is nothing like them.
  I've spend the last 3 hours searching for a solution.
  I don't have many connections / statements / resultsets and I always close all of them.
  My code used to work but now I get the "System resource exceeded" exception, not during queries, but <strong><em>WHEN I TRY TO CONNECT</em></strong>.
  I didn't change a thing from my code, however it doesn't work at the moment, except 1 out of 10 times I try it. I tried to change some things in it but no difference.
  My Access files are 15 - 50 MB.
  My code is:</p>
  
  <pre><code>private String accessFilePath;
  private Connection myConnection;
  public boolean connectToAccess(String myAccessFilePath) {
      accessFilePath = myAccessFilePath;
      //Get connection to database
      try {
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
          // set properties for unicode
          Properties myProperties = new Properties();
          myProperties.put("charSet", "windows-1253");
          myConnection = DriverManager.getConnection("jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=" + accessFilePath, myProperties); // I get the exception here
      } catch (Exception ex) {
          System.out.println("Failed to connect to " + accessFilePath + " database\n" + ex.getMessage());
          return false;
      }
      return true;
  }
  </code></pre>
  
  <p>What is now different from other times? Do Access files keep previous connections open? What can be wrong here?</p>