filemaker mysql_如何将数据库从Filemaker迁移到Mysql?

我现在使用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);

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值