public LocalRepository createJDBCRepository(JDBCRepositoryConfiguration configuration)
      throws RepositoryException {

    JDBCDriverVendor vendor = configuration.getDriverVendor();

    DataSource dataSource = configuration.getDataSource();
    if (vendor == null) {
      vendor = getVendorFromDatabase(dataSource);
    }

    VendorFactory factory = (VendorFactory) VENDOR_2_FACTORY.get(vendor);
    if (factory == null) {
      throw new JDBCRepositoryException(EXCEPTION_LOCALIZER.format("jdbc-unknown-vendor", vendor));
    }

    InternalJDBCRepository repository =
        factory.createRepository((InternalJDBCRepositoryConfiguration) configuration);

    JDBCRepositoryConnection connection = null;
    try {
      connection = (JDBCRepositoryConnection) repository.connect();
      connection.getConnection();

    } finally {
      connection.disconnect();
    }

    return repository;
  }
  public DataSource createMCSDriverDataSource(MCSDriverConfiguration configuration)
      throws JDBCRepositoryException, RepositoryException {

    // Get the vendor string.
    JDBCDriverVendor vendor = configuration.getDriverVendor();
    if (vendor == null) {
      throw new JDBCRepositoryException(EXCEPTION_LOCALIZER.format("jdbc-missing-vendor"));
    }

    VendorFactory factory = (VendorFactory) VENDOR_2_FACTORY.get(vendor);
    if (factory == null) {
      throw new JDBCRepositoryException(EXCEPTION_LOCALIZER.format("jdbc-unknown-vendor", vendor));
    }

    DataSource dataSource = factory.createDriverDataSource(configuration);

    return createMCSConnectionPool(configuration.getConnectionPoolConfiguration(), dataSource);
  }