Package com.splout.db.engine.EmbeddedMySQL

Examples of com.splout.db.engine.EmbeddedMySQL.EmbeddedMySQLConfig


    File dbFolder = dbFile.getParentFile();
    File mysqlFolder = new File(dbFolder, "mysql");

    PortLock portLock = PortUtils.getNextAvailablePort(EmbeddedMySQLConfig.DEFAULT_PORT);
    try {
      EmbeddedMySQLConfig mysqlConfig = new EmbeddedMySQLConfig(portLock.getPort(),
          EmbeddedMySQLConfig.DEFAULT_USER, EmbeddedMySQLConfig.DEFAULT_PASS, mysqlFolder, null);
      mySQL = new EmbeddedMySQL(mysqlConfig);
      // Trick: start mysql first on the empty dir, stop it, uncompress data, start it again
      // This is because mySQL creates some databases by default which doesn't create if "data" already exists
      // So we don't need to add them to the produced zip (1.6 MB less).
View Full Code Here


    LOG.info("Initializing SQL connection [" + partition + "]");
    try {
      PortLock portLock = PortUtils.getNextAvailablePort(EmbeddedMySQLConfig.DEFAULT_PORT);

      EmbeddedMySQL mySQL = null;
      EmbeddedMySQLConfig config = null;

      try {
        File mysqlDir = new File(mysqlDb.toString());
        LOG.info("Going to instantiate a MySQLD in: " + mysqlDir + ", port [" + portLock.getPort()
            + "] (partition: " + partition + ")");

        config = new EmbeddedMySQLConfig(portLock.getPort(), EmbeddedMySQLConfig.DEFAULT_USER,
            EmbeddedMySQLConfig.DEFAULT_PASS, mysqlDir, null);
        mySQL = new EmbeddedMySQL(config);
        mySQL.start(true);
      } catch(Exception e) {
        throw e;
      } finally {
        portLock.release();
      }

      mySQLs.put(partition, mySQL);

      // MySQL is successfully started at this point, or an Exception would have been thrown.
      Class.forName(EmbeddedMySQL.DRIVER);
      Connection conn = DriverManager.getConnection(config.getLocalJDBCConnection(GENERATED_DB_NAME),
          config.getUser(), config.getPass());
      conn.setAutoCommit(false);
      connCache.put(partition, conn);
      Statement st = conn.createStatement();

      // Init transaction
View Full Code Here

TOP

Related Classes of com.splout.db.engine.EmbeddedMySQL.EmbeddedMySQLConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.