我现在使用JDBC在Java中执行此操作。您需要将JDBC驱动程序和MySQL导入库中。我目前正在查看其他帖子,了解处理大量数据的最佳做法。
您可能必须自己在MySQL中创建表,我可能会推荐它,因为FMPro通常有一个奇怪的设置,您可能不想完全复制(我注意到最近的一个文本字段必须被设定为一个长度或者事情只是乱七八糟..)。一个简单的下午在MySQL Developer中工作(或者他们现在称之为的任何东西)绘制一些漂亮的图表?
这是一些作弊:
public static String dbaseURL = "jdbc:filemaker://machineIP:2399/database";
public static void FMProConnect() {
// Load the JDBC to ODBC driver
try {
Class.forName("com.filemaker.jdbc.Driver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
}
public static void copyTable(){
FMProConnection.FMProConnect();
Connection dbConnection = null;
Statement query = null;
PreparedStatement stmt = null;
try {
// Create a database connection
dbConnection =
DriverManager.getConnection(dbaseURL, "fmprouser", "fmpropassword");
// Create a statement and execute the SQL query
query = dbConnection.createStatement();
}
catch (SQLException e) {
System.out.println("Error connecting to dbase.");
e.printStackTrace();
//System.exit(1);
}
ResultSet results = null;
try {
results =
query.executeQuery("SELECT * from table");
// Iterate through the results and print them to standard output
Connection con = DriverManager.getConnection("jdbc:mysql://mysqlserver.com/database","username","password");
while (results.next()) {
String fname = results.getString("field");
String lname = results.getString("field1");
// System.out.println("Found user \"" + fname + " " + lname + "\"");
stmt = con.prepareStatement("INSERT ignore INTO table (field, field1 values (?, ?)");
stmt.setString(1, fname);
stmt.setString(2, lname);
stmt.executeUpdate();
}
System.out.println("Completed Customers");
}
catch (SQLException e) {
System.out.println("Error retrieving data from database.");
e.printStackTrace();
//System.exit(1);
}
}