WebObjects/Database Compatibility and Comparisons/DataMigration

From Wikibooks, open books for an open world
< WebObjects
Jump to: navigation, search

Project Wonder[edit]

ProjectWonder provides a really handy tool for migrating data between two databases:

 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://localhost/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);