title: How to create a table in access database using java
body: <p>i need to create a table in access database. For this i tried with the following code</p>
  
  <pre><code>    public class Testac {
  
      public static void main(String[] args) {
          try {
  
              System.out.println("Begining conn");
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              String accessFileName = "Centre";
              String connURL = "jdbc:odbc:;DRIVER=Microsoft Access Driver (*.accdb);DBQ=" + accessFileName + ".accdb;PWD=";
              Connection con = DriverManager.getConnection(connURL, "", "");
              Statement stmt = con.createStatement();
              System.out.println("Conn done succesfully");
              stmt.execute("create table student ( Name string, ID integer )"); // create a student
              stmt.execute("insert into student values(‘Md. SHAHJALAL’, ‘02223540’)"); // insert data into student
              stmt.execute("select * from student"); // execute query in table student
              ResultSet rs = stmt.getResultSet(); // get any Resultt that came from our query
              if (rs != null) {
                  while (rs.next()) {
                      System.out.println("Name: " + rs.getString("Name") + " ID: " + rs.getString("ID"));
                  }
              }
              stmt.close();
              con.close();
          } catch (Exception err) {
              System.out.println("ERROR: " + err);
          }
      }
  }
  </code></pre>
  
  <p>But it throws the following error " <code>ERROR: java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified</code> ". </p>