Java Code Examples for ch.vorburger.mariadb4j.DBConfigurationBuilder#setPort()

The following examples show how to use ch.vorburger.mariadb4j.DBConfigurationBuilder#setPort() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractEmbeddedDataSourceHelper.java    From freeacs with MIT License 8 votes vote down vote up
public static void setUpBeforeClass() throws ManagedProcessException {
    randomFolder = "./db/" + UUID.randomUUID();
    DBConfigurationBuilder configBuilder = DBConfigurationBuilder.newBuilder();
    configBuilder.setPort(3307);
    configBuilder.setDataDir(randomFolder);
    db = DB.newEmbeddedDB(configBuilder.build());
    db.start();
    db.createDB("acs", "acs", "acs");
    db.source("install.sql", "acs", "acs", "acs");
    String url = configBuilder.getURL("acs");
    HikariConfig hikariConfig = new HikariConfig();
    hikariConfig.setDataSourceClassName("org.mariadb.jdbc.MariaDbDataSource");
    hikariConfig.addDataSourceProperty("url", url);
    hikariConfig.addDataSourceProperty("user", "acs");
    hikariConfig.addDataSourceProperty("password", "acs");
    dataSource = new HikariDataSource(hikariConfig);
}
 
Example 2
Source File: MySQLTestCore.java    From rmlmapper-java with MIT License 5 votes vote down vote up
protected static DB setUpMySQLDBInstance(int portNumber) throws ManagedProcessException {
    DBConfigurationBuilder configBuilder = DBConfigurationBuilder.newBuilder();
    configBuilder.setPort(portNumber);
    configBuilder.addArg("--user=root");
    configBuilder.addArg("--sql-mode=STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,ANSI_QUOTES");
    DB mysqlDB = DB.newEmbeddedDB(configBuilder.build());
    mysqlDB.start();

    return mysqlDB;
}
 
Example 3
Source File: App.java    From hawkular-apm with Apache License 2.0 5 votes vote down vote up
private DB createDatabase() throws ManagedProcessException {

        DBConfigurationBuilder configBuilder = DBConfigurationBuilder.newBuilder();
        configBuilder.setPort(3306);
        configBuilder.setDataDir("target/mariaDB");
        configBuilder.setBaseDir("target/mariaDB");
        DB database = DB.newEmbeddedDB(configBuilder.build());
        database.start();

        return database;
    }