跳转至内容

WebObjects/数据库兼容性和比较/数据迁移

来自维基教科书,面向开放世界的开放书籍

Project Wonder

[编辑 | 编辑源]

ProjectWonder 提供一款用于在两个数据库之间迁移数据的非常便捷的工具

 NSMutableDictionary sourceDict = new NSMutableDictionary();
 sourceDict.setObjectForKey("YourPassword", "password");
 sourceDict.setObjectForKey("YourUserName", "username");
 sourceDict.setObjectForKey("jdbc:FrontBase://127.0.0.1/YourSourceDatabase", "URL");
 sourceDict.setObjectForKey("com.frontbase.jdbc.FBJDriver", "driver");
 sourceDict.setObjectForKey(Boolean.FALSE.toString(), "autoCommit");
 sourceDict.setObjectForKey(Boolean.TRUE.toString(), "readOnly");
 sourceDict.setObjectForKey(Boolean.TRUE.toString(), "quote");
 
 NSMutableDictionary destDict = sourceDict.mutableClone();
 destDict.setObjectForKey("jdbc:postgresql://127.0.0.1/YourDestinationDatabase", "URL");
 destDict.setObjectForKey("YourPassword", "password");
 destDict.setObjectForKey("YourUserName", "username");
 destDict.setObjectForKey("org.postgresql.Driver", "driver");
 destDict.setObjectForKey(Boolean.FALSE.toString(), "autoCommit");
 destDict.setObjectForKey(Boolean.FALSE.toString(), "readOnly");
 destDict.setObjectForKey(Boolean.FALSE.toString(), "quote");
 
 EOModel model = EOModelGroup.defaultGroup().modelNamed("YourModelName");
 ERXJDBCUtilities._copyDatabaseDefinedByEOModelAndConnectionDictionaryToDatabaseWithConnectionDictionary(model, sourceDict, destDict);
华夏公益教科书