Wiki source code of Programming__WebObjects-Database Compatibility and Comparisons-DataMigration
Version 1.1 by smmccraw on 2007/07/08 10:29
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | == Project Wonder == | ||
| 2 | |||
| 3 | ProjectWonder provides a really handy tool for migrating data between two databases: | ||
| 4 | |||
| 5 | {{panel}} | ||
| 6 | |||
| 7 | NSMutableDictionary sourceDict = new NSMutableDictionary(); | ||
| 8 | sourceDict.setObjectForKey("YourPassword", "password"); | ||
| 9 | sourceDict.setObjectForKey("YourUserName", "username"); | ||
| 10 | sourceDict.setObjectForKey("jdbc:FrontBase://127.0.0.1/YourSourceDatabase", "URL"); | ||
| 11 | sourceDict.setObjectForKey("com.frontbase.jdbc.FBJDriver", "driver"); | ||
| 12 | sourceDict.setObjectForKey(Boolean.FALSE.toString(), "autoCommit"); | ||
| 13 | sourceDict.setObjectForKey(Boolean.TRUE.toString(), "readOnly"); | ||
| 14 | sourceDict.setObjectForKey(Boolean.TRUE.toString(), "quote"); | ||
| 15 | |||
| 16 | NSMutableDictionary destDict = sourceDict.mutableClone(); | ||
| 17 | destDict.setObjectForKey("jdbc:postgresql://localhost/YourDestinationDatabase", "URL"); | ||
| 18 | destDict.setObjectForKey("YourPassword", "password"); | ||
| 19 | destDict.setObjectForKey("YourUserName", "username"); | ||
| 20 | destDict.setObjectForKey("org.postgresql.Driver", "driver"); | ||
| 21 | destDict.setObjectForKey(Boolean.FALSE.toString(), "autoCommit"); | ||
| 22 | destDict.setObjectForKey(Boolean.FALSE.toString(), "readOnly"); | ||
| 23 | destDict.setObjectForKey(Boolean.FALSE.toString(), "quote"); | ||
| 24 | |||
| 25 | EOModel model = EOModelGroup.defaultGroup().modelNamed("YourModelName"); | ||
| 26 | ERXJDBCUtilities._copyDatabaseDefinedByEOModelAndConnectionDictionaryToDatabaseWithConnectionDictionary(model, sourceDict, destDict); | ||
| 27 | |||
| 28 | {{/panel}} |