title: Connecting Java to an MS Access Database without having MS Access installed
body: <p>I have created a CRUD Application the connecting method of the application is given below. I have tested it on my computer and is working fine, but while tesing on another computer where MS Access is not installed it is throwing <code>NullPointerException</code>. </p>
  
  <p>So what should I do in order to rectify this problem? Are there any libraries for connecting to .mdb files?</p>
  
  <p>These should also run on Linux. I can convert the .mdb file into Open Office Base if Libraries are available...</p>
  
  <pre><code>void DoConnect()
  {
      try{
      String current = new java.io.File( "." ).getCanonicalPath();
      current+="\\DataBases\\Quiz.mdb";
      String host = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ="+current+";";
      String uName = "";
      String uPass = "";
      con=new Connection[Size];
      stmt=new Statement[Size];
      for(int i=0;i&lt;Size;i++)
      {
          con[i]=DriverManager.getConnection(host, uName, uPass);
          stmt[i]=con[i].createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
      }
      ts=stmt[0].executeQuery("SELECT * FROM Quiz");
      ts.first();
      rs=stmt[1].executeQuery("SELECT ANSW FROM Quiz");       
  
      System.out.print(rs.getString("STM1"));
      }catch (IOException | SQLException err) {
  
      }      
  }
  </code></pre>