title: No suitable driver found when making SQL connection to MS Access Database in java
body: <p>I have a Jbutton (GetDataFromDB) in a simple java application that is suppose to load the data from the database depicted in the path in the code below into a Jtable in the application. </p>
  
  <p>Edited answer into code:</p>
  
  <pre><code>private void GetDataFromDBActionPerformed(java.awt.event.ActionEvent evt) {                                              
      Connection con;
      ResultSet rs = null;
      Statement stmt;
  
      try {
  
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      con = DriverManager.getConnection("jdbc:odbc:Driver={MS Access Driver (*.mdb, *.accdb)};Dbq=C:\\Users\\Bruger\\Documents\\Database11.accdb");
  
      stmt = con.createStatement();
      String query = null;
      query = "select * from cost";
  
      rs = stmt.executeQuery(query);
  
      i = 0;
  
      while (rs.next()){
          i = i + 1;
          jTable.getModel().setValueAt(rs.getString(1), i, 1);
          jTable.getModel().setValueAt(rs.getString(2), i, 2);
      }
  
  
      rs.close();
      stmt.close();
      con.close();
      } catch(Exception err){
      System.out.println(err.getMessage());
  }
  
  }  
  </code></pre>
  
  <p>When I press the button I get the following message in the run output window:</p>
  
  <p><em>No suitable driver found for jdbc:odbc:Driver={Microsoft Access Driver (</em>.mdb, <em>.accdb)};Dbq=C:\Users\Bruger\Documents\Database11.accdb</em>        </p>
  
  <p>I have at the top of my code the import:</p>
  
  <pre><code>import java.sql.*;
  </code></pre>
  
  <p>I have also tried changing from "Microsoft Access Driver" to "MS Access Driver" but I get the same message in the run output window i.e.</p>
  
  <p><em>No suitable driver found for jdbc:odbc:Driver={MS Access Driver (</em>.mdb, <em>.accdb)};Dbq=C:\Users\Bruger\Documents\Database11.accdb</em></p>
  
  <p>I'm really thankful for all your help, input and feedback.</p>