title: Windows 8.1. - Java - ODBC Driver - NetBeans
body: <p>I am trying to connect Java app to MSAccess in NetBeans IDE (pls don't tell me not to use Access, because we are using it in classes, and that's just it for now :)). I didn't have this problem on Windows 7, and I couldn't find answer using Google, so I decided to post this question.
  So, it's like this, I have:</p>
  
  <ul>
  <li>Windows 8.1 (64-bit)</li>
  <li>Java jdk1.8.0 (32-bit)</li>
  <li>NetBeans IDE 8.0, and NetBeans jdk home (from netbeans.conf) is: "C:\Program Files (x86)\Java\jdk1.8.0", so it's using 32-bit jdk.</li>
  </ul>
  
  <p>Code for loading driver:</p>
  
  <pre><code>public void loadDriver() throws RuntimeException {
      try {
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      } catch (Exception e) {
          throw new RuntimeException("Could not load driver!");
      }
  }
  </code></pre>
  
  <p>Code for opening connection:</p>
  
  <pre><code>public void openConnection() throws RuntimeException {
      try {
          connection = DriverManager.getConnection("jdbc:odbc:db");
          connection.setAutoCommit(false);
      } catch (Exception e) {
          throw new RuntimeException("Could not connect!");
      }
  }
  </code></pre>
  
  <p>Of course, there's an attribute: 
  private Connection connection; (and import java.sql.Connection;)</p>
  
  <p>There is a problem at loading driver - <strong>it always says "could not load driver"</strong>. If I have to post more code or change something in what I've posted, please tell me and I will.</p>
  
  <p>I went to: SysWOW64 - odbcad32.exe - Add... - Microsoft Access Driver (*.mdb, *.accdb), and then for Data source name I've put of course "db" (like in my code above) and selected the database (.accdb file) that I will use. And I don't know if it is the Windows 8 issue or I'm forgetting something, but I really have no clue how to make it work.</p>