try {
final DbAdapter adapterInst = (adapter == null) ? new JdbcAdapter()
: (DbAdapter) Class.forName(adapter).newInstance();
// load driver taking custom CLASSPATH into account...
DriverDataSource dataSource = new DriverDataSource((Driver) Class.forName(driver).newInstance(), url, username, password);
// Load the data map and run the db importer.
final LoaderDelegate loaderDelegate = new LoaderDelegate();
final DbLoader loader = new DbLoader(dataSource.getConnection(), adapterInst, loaderDelegate);
loader.setCreatingMeaningfulPK(meaningfulPk);
if (namingStrategy != null) {
final NamingStrategy namingStrategyInst = (NamingStrategy) Class.forName(namingStrategy).newInstance();
loader.setNamingStrategy(namingStrategyInst);