Programming__WebObjects-Database Compatibility and Comparisons-DataMigration

Version 2.1 by smmccraw on 2007/07/08 10:29

Project Wonder

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("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);