title: Reading Visual Foxpro Data From Java using ODBC
body: <p>I am trying to query a dbf table from my Java application. I put in reference this <a href="https://stackoverflow.com/questions/4818023/reading-a-foxpro-2-6-data-with-java">thread</a> </p>
  
  <p>I created a system data source using the ODBC Data Source Administrator, I set the data source name to be VFPDS and set the database type to .DBC finaly i set the path to the .dbc file.</p>
  
  <p>the following is my java code:   </p>
  
  <pre><code>import javax.swing.* ;
  import java.awt.* ;
  import java.awt.event.* ;
  import java.sql.Connection;
  import java.sql.ResultSet;
  import java.sql.SQLException;
  import java.sql.SQLWarning;
  import java.sql.Statement;
  // Import custom library containing myRadioListener
  import java.sql.DriverManager;
  
  public class testodbc {
  
  public static void main( String args[] )
  {
      try
      {
          // Load the database driver
          Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" ) ;
  
          // Get a connection to the database
          Connection conn = DriverManager.getConnection( "jdbc:odbc:VFPDS" ) ;
  
          // Print all warnings
          for( SQLWarning warn = conn.getWarnings(); warn != null; warn = warn.getNextWarning() )
          {
              System.out.println( "SQL Warning:" ) ;
              System.out.println( "State  : " + warn.getSQLState()  ) ;
              System.out.println( "Message: " + warn.getMessage()   ) ;
              System.out.println( "Error  : " + warn.getErrorCode() ) ;
          }
  
          // Get a statement from the connection
          Statement stmt = conn.createStatement() ;
  
          // Execute the query
          ResultSet rs = stmt.executeQuery( "SELECT * FROM pmsquoteh" ) ;//code crashes here
  
          // Loop through the result set
          while( rs.next() )
              System.out.println( rs.getString(1) ) ;
  
          // Close the result set, statement and the connection
          rs.close() ;
          stmt.close() ;
          conn.close() ;
      }
      catch( SQLException se )
      {   se.printStackTrace();
          System.out.println( "SQL Exception:" ) ;
  
          // Loop through the SQL Exceptions
          while( se != null )
          {   se.printStackTrace();
              System.out.println( "State  : " + se.getSQLState()  ) ;
              System.out.println( "Message: " + se.getMessage()   ) ;
              System.out.println( "Error  : " + se.getErrorCode() ) ;
  
              se = se.getNextException() ;
          }
      }
      catch( Exception e )
      {
          System.out.println( e ) ;
      }
  }
  }
  </code></pre>
  
  <p>I got this exception :</p>
  
  <pre><code>java.sql.SQLException: [Microsoft][ODBC Visual FoxPro Driver]Not a table.
  at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
  at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
  at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
  at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
  at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(Unknown Source)
  at UsingButtons.main(testodbc.java:38)
  
  SQL Exception:
  State  : S0002
  Message: [Microsoft][ODBC Visual FoxPro Driver]Not a table.
  Error  : 123
  </code></pre>
  
  <p>I am sure that the table pmsquoteh exits in the database and my machine is a 64 bit machine.
  What am i doing wrong ? I would appreciate specific answers. </p>