// private const String MYSQL_DB = "mysql"; #endregion #region Methods /// <summary> /// Determines the type of database we're configured to use and returns the appropriate connection /// object /// </summary> /// <returns></returns> public DbConnection getConnection() { /* * Determine the type of database we're configured to use */ log.Debug("Getting configuration information from ConfigurationManager"); MigrationConfigurationManager configMgr = new MigrationConfigurationManager(); DBConfiguration dbConfig = configMgr.getDBConfiguration(); /* * Determine the type of DB */ if (dbConfig.DatabaseType == ORACLE_DB) { return getOracleConnection(dbConfig); } return getSQLConnection(dbConfig); //TODO: throw exception if configured for a different database type }
/// <summary> Loads the configuration from the migration config properties file. /// /// </summary> /// <param name="launcher">the launcher to configure /// </param> /// <param name="systemName">the name of the system /// </param> /// <throws> MigrationException if an unexpected error occurs </throws> private void configureFromMigrationProperties(AdoMigrationLauncher launcher, System.String systemName) { MigrationConfigurationManager configMgr = new MigrationConfigurationManager(); DBConfiguration dbConfig = configMgr.getDBConfiguration(); MigrationConfiguration migrationConfig = configMgr.getMigrationConfiguration(); launcher.PatchPath = migrationConfig.PatchPath; launcher.PostPatchPath = migrationConfig.PostPatchPath; DataSourceMigrationContext context = DataSourceMigrationContext; System.String databaseType = dbConfig.DatabaseType; context.DatabaseType = new DatabaseType(databaseType); // Finish setting up the context context.SystemName = systemName; //context.DataSource = dataSource; // done reading in config, set launcher's context launcher.AddContext(context); }