migratedb.v1.commandline.driversupport.SnowflakeDriverSupport Maven / Gradle / Ivy
package migratedb.v1.commandline.driversupport;
import com.google.auto.service.AutoService;
import migratedb.v1.commandline.DriverSupport;
@AutoService(DriverSupport.class)
public class SnowflakeDriverSupport implements DriverSupport {
@Override
public String getName() {
return "Snowflake";
}
@Override
public boolean detectUserRequiredByUrl(String url) {
// Using Snowflake private-key auth instead of password allows user to be passed on URL
return !url.contains("user=");
}
@Override
public boolean detectPasswordRequiredByUrl(String url) {
// Using Snowflake private-key auth instead of password
return !url.contains("private_key_file=");
}
@Override
public boolean handlesJdbcUrl(String url) {
return url.startsWith("jdbc:snowflake:") || url.startsWith("jdbc:p6spy:snowflake:");
}
@Override
public String getDriverClass(String url, ClassLoader classLoader) {
if (url.startsWith("jdbc:p6spy:snowflake:")) {
return "com.p6spy.engine.spy.P6SpyDriver";
}
return "net.snowflake.client.jdbc.SnowflakeDriver";
}
}