migratedb.v1.commandline.driversupport.MariaDBDriverSupport Maven / Gradle / Ivy
package migratedb.v1.commandline.driversupport;
import com.google.auto.service.AutoService;
import migratedb.v1.commandline.DriverSupport;
import java.util.Properties;
@AutoService(DriverSupport.class)
public class MariaDBDriverSupport implements DriverSupport {
@Override
public String getName() {
return "MariaDB";
}
@Override
public boolean handlesJdbcUrl(String url) {
return url.startsWith("jdbc:mariadb:") || url.startsWith("jdbc:p6spy:mariadb:");
}
@Override
public String getDriverClass(String url, ClassLoader classLoader) {
if (url.startsWith("jdbc:p6spy:mariadb:")) {
return "com.p6spy.engine.spy.P6SpyDriver";
}
return "org.mariadb.jdbc.Driver";
}
@Override
public void modifyDefaultConnectionProps(String url, Properties props, ClassLoader classLoader) {
props.put("connectionAttributes", "program_name:" + APPLICATION_NAME);
}
}