@Override public String from(Dbms dbms) { final StringBuilder result = new StringBuilder() .append("jdbc:mariadb://") .append(dbms.getIpAddress().orElse("")); dbms.getPort().ifPresent(p -> result.append(":").append(p)); result/*.append("/").append(dbms.getName()) */ // MariaDB treats this as default schema name .append("?useUnicode=true&characterEncoding=UTF-8") .append("&useServerPrepStmts=true&useCursorFetch=true") .append("&zeroDateTimeBehavior=convertToNull"); return result.toString(); } }
@Override public String from(Dbms dbms) { final StringBuilder result = new StringBuilder() .append("jdbc:postgresql://") .append(dbms.getIpAddress().orElse("")); dbms.getPort().ifPresent(p -> result.append(":").append(p)); result.append("/").append(dbms.getName()); result.append("?stringtype=unspecified"); // to allow database JSON types to be written return result.toString(); } }
@Override public String from(Dbms dbms) { final StringBuilder result = new StringBuilder() .append("jdbc:mysql://") .append(dbms.getIpAddress().orElse("")); dbms.getPort().ifPresent(p -> result.append(":").append(p)); result/*.append("/").append(dbms.getName())*/ // MySQL treats this as default schema name .append("?useUnicode=true&characterEncoding=UTF-8") .append("&useServerPrepStmts=true") .append("&zeroDateTimeBehavior=") .append(driverVersion() >= 8 ? "CONVERT_TO_NULL" : "convertToNull") .append("&nullNamePatternMatchesAll=true") // Fix #190 .append("&useLegacyDatetimeCode=true"); // Fix #190 if (driverVersion() <= 5) { result.append("&useSSL=false"); } else { result.append("&serverTimezone=UTC"); } return result.toString(); } }
ImmutableDbms(ImmutableProject parent, Map<String, Object> dbms) { super(parent, requireKeys(dbms, Dbms.TYPE_NAME)); final Dbms prototype = new DbmsImpl(parent, dbms); this.enabled = prototype.isEnabled(); this.id = prototype.getId(); this.name = prototype.getName(); this.alias = prototype.getAlias(); this.typeName = prototype.getTypeName(); this.ipAddress = prototype.getIpAddress(); this.port = prototype.getPort(); this.username = prototype.getUsername(); this.schemas = unmodifiableList(super.children(SCHEMAS, ImmutableSchema::new).collect(toList())); }
public StringProperty ipAddressProperty() { return stringPropertyOf(IP_ADDRESS, () -> Dbms.super.getIpAddress().orElse(null)); }