Can I create a FoxPro table fro java? The below code does not throw any errors and does not create a table. If I try to insert a row I will get an error saying the table file does not exist.
Here is my code:
Code:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
public class FoxProOdbc {
public static void main(String[] args) {
Connection conn = null;
Statement stmnt = null;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn = DriverManager.getConnection("jdbc:odbc:FoxProTest", "", "");
stmnt = conn.createStatement();
String sql = "Create TABLE testtable (testme char(10))";
stmnt.executeUpdate(sql);
conn.commit();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {if (stmnt != null) stmnt.close();} catch (Exception ignore) {}
try {if (conn != null) conn.close();} catch (Exception ignore) {}
}
}
}