Package com.oltpbenchmark.util

Examples of com.oltpbenchmark.util.ScriptRunner


    public final void createDatabase(DatabaseType dbType, Connection conn) throws SQLException {
        try {
            File ddl = this.getDatabaseDDL(dbType);
            assert(ddl != null) : "Failed to get DDL for " + this;
            assert(ddl.exists()) : "The file '" + ddl + "' does not exist";
            ScriptRunner runner = new ScriptRunner(conn, true, true);
            if (LOG.isDebugEnabled()) LOG.debug("Executing script '" + ddl.getName() + "'");
            runner.runScript(ddl);
        } catch (Exception ex) {
            throw new RuntimeException(String.format("Unexpected error when trying to create the %s database", this.benchmarkName), ex);
        }
    }
View Full Code Here


     * Run a script on a Database
     */
    public final void runScript(String script) {
        try {
            Connection conn = this.makeConnection();
            ScriptRunner runner = new ScriptRunner(conn, true, true);
            File scriptFile= new File(script);
            runner.runScript(scriptFile);
            conn.close();
        } catch (SQLException ex) {
            throw new RuntimeException(String.format("Unexpected error when trying to run: %", script), ex);
        } catch (IOException ex) {
            throw new RuntimeException(String.format("Unexpected error when trying to open: %", script), ex);
View Full Code Here

     * @param c
     * @param path
     * @return
     */
    protected final boolean executeFile(Connection c, File path) {
        ScriptRunner runner = new ScriptRunner(c, true, false);
        try {
            runner.runScript(path);
        } catch (Exception ex) {
            ex.printStackTrace();
            LOG.error("Failed to execute script '" + path + "'", ex);
            return (false);
        }
View Full Code Here

TOP

Related Classes of com.oltpbenchmark.util.ScriptRunner

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.