mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-12 22:41:35 +00:00
ADD: Db2 container support
This commit is contained in:
1 parent
067f4bfdea
commit
dfb1d6ab54
5 files changed
+71
-5
No files matched your search
@@ -0,0 +1,41 @@
|
||||
package io.ebean.test.config.platform;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
class Db2Setup implements PlatformSetup {
|
||||
|
||||
@Override
|
||||
public Properties setup(Config config) {
|
||||
|
||||
config.ddlMode("dropCreate");
|
||||
config.setDefaultPort(50000);
|
||||
config.setUsernameDefault();
|
||||
config.setPasswordDefault();
|
||||
config.setUrl("jdbc:db2://localhost:${port}/${databaseName}");
|
||||
config.setDriver("com.ibm.db2.jcc.DB2Driver");
|
||||
config.datasourceDefaults();
|
||||
|
||||
return dockerProperties(config);
|
||||
}
|
||||
|
||||
private Properties dockerProperties(Config dbConfig) {
|
||||
|
||||
if (!dbConfig.isUseDocker()) {
|
||||
return new Properties();
|
||||
}
|
||||
|
||||
dbConfig.setDockerVersion("11.5.6.0a");
|
||||
return dbConfig.getDockerProperties();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupExtraDbDataSource(Config config) {
|
||||
// not supported yet
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLocal() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -34,6 +34,7 @@ public class PlatformAutoConfig {
|
||||
KNOWN_PLATFORMS.put("clickhouse", new ClickHouseSetup());
|
||||
KNOWN_PLATFORMS.put("cockroach", new CockroachSetup());
|
||||
KNOWN_PLATFORMS.put("hana", new HanaSetup());
|
||||
KNOWN_PLATFORMS.put("db2", new Db2Setup());
|
||||
}
|
||||
|
||||
private final DatabaseConfig config;
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package main;
|
||||
|
||||
import io.ebean.docker.commands.Db2Config;
|
||||
import io.ebean.docker.commands.Db2Container;
|
||||
|
||||
public class StartDb2 {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
Db2Config config = new Db2Config("11.5.6.0a");
|
||||
config.setDbName("unit");
|
||||
config.setUser("unit");
|
||||
config.setPassword("unit");
|
||||
|
||||
// to change collation, charset and other parameters like pagesize:
|
||||
config.setCreateOptions("USING CODESET UTF-8 TERRITORY DE COLLATE USING IDENTITY PAGESIZE 32768");
|
||||
config.setConfigOptions("USING STRING_UNITS CODEUNITS32");
|
||||
|
||||
Db2Container container = new Db2Container(config);
|
||||
container.startWithDropCreate();
|
||||
}
|
||||
}
|
||||
@@ -181,9 +181,9 @@ datasource.nuodb.password=test
|
||||
datasource.nuodb.url=jdbc:com.nuodb://localhost/testdb
|
||||
#datasource.nuodb.driver=com.nuodb.jdbc.Driver
|
||||
|
||||
datasource.db2.username=db2admin
|
||||
datasource.db2.password=veryverysecret#1234
|
||||
datasource.db2.url=jdbc:db2://127.0.0.1:50000/SAMPLE
|
||||
datasource.db2.username=unit
|
||||
datasource.db2.password=test
|
||||
datasource.db2.url=jdbc:db2://127.0.0.1:50000/unit
|
||||
#datasource.db2.driver=com.ibm.db2.jcc.DB2Driver
|
||||
|
||||
datasource.hana.username=EBEAN_TEST
|
||||
|
||||
Reference in new issue
Block a user