Package org.apache.commons.dbutils

Examples of org.apache.commons.dbutils.QueryRunner


    {
        Connection con = null;
        try
        {
            con = getConnection();
            return new QueryRunner().update(con, sql);
        }
        finally
        {
            JdbcUtils.close(con);
        }
View Full Code Here


    {
        Connection con = null;
        try
        {
            con = getConnection();
            return new QueryRunner().update(con, sql);
        }
        finally
        {
            JdbcUtils.close(con);
        }
View Full Code Here

    {
        Connection con = null;
        try
        {
            con = getConnection();
            return (Object[])new QueryRunner().query(con, sql, new ArrayHandler());
        }
        finally
        {
            JdbcUtils.close(con);
        }
View Full Code Here

        super.doTearDown();
    }

    protected void createTable() throws Exception
    {
        QueryRunner qr = jdbcConnector.getQueryRunner();
        qr.update(jdbcConnector.getConnection(), "CREATE TABLE TEST(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0)  NOT NULL PRIMARY KEY,TYPE INTEGER,DATA VARCHAR(255),ACK TIMESTAMP,RESULT VARCHAR(255))");
        logger.debug("Table created");
    }
View Full Code Here

        logger.debug("Table created");
    }
   
    protected void deleteTable() throws Exception
    {
        QueryRunner qr = jdbcConnector.getQueryRunner();
        int updated = qr.update(jdbcConnector.getConnection(), "DELETE FROM TEST");
        logger.debug(updated + " rows deleted");
    }
View Full Code Here

        logger.debug(updated + " rows deleted");
    }
   
    protected void populateTable() throws Exception
    {
        QueryRunner qr = jdbcConnector.getQueryRunner();
        int updated;
        updated = qr.update(jdbcConnector.getConnection(), "INSERT INTO TEST(TYPE, DATA) VALUES (1, '" + TEST_VALUES[0] + "')");
        logger.debug(updated + " rows updated");
        updated = qr.update(jdbcConnector.getConnection(), "INSERT INTO TEST(TYPE, DATA) VALUES (2, '" + TEST_VALUES[1] + "')");
        logger.debug(updated + " rows updated");
        updated = qr.update(jdbcConnector.getConnection(), "INSERT INTO TEST(TYPE, DATA) VALUES (3, '" + TEST_VALUES[2] + "')");
        logger.debug(updated + " rows updated");
    }
View Full Code Here

    {
        Connection con = null;
        try
        {
            con = jdbcConnector.getConnection();
            return (List)new QueryRunner().query(con, sql, new ArrayListHandler());
        }
        finally
        {
            JdbcUtils.close(con);
        }
View Full Code Here

    {
        Connection con = null;
        try
        {
            con = jdbcConnector.getConnection();
            return new QueryRunner().update(con, sql);
        }
        finally
        {
            JdbcUtils.close(con);
        }
View Full Code Here

    @Override
    protected void doSetUp() throws Exception
    {
        super.doSetUp();
        JdbcObjectStore<?> store = muleContext.getRegistry().get("jdbcObjectStore");
        QueryRunner qr = store.getJdbcConnector().getQueryRunner();
       
        try
        {
            qr.update(store.getJdbcConnector().getConnection(), "DELETE FROM IDS");
        }
        catch (Exception e)
        {
        }
       
        try
        {
            qr.update(store.getJdbcConnector().getConnection(),
                "CREATE TABLE IDS(K VARCHAR(255) NOT NULL PRIMARY KEY, VALUE VARCHAR(255))");
        }
        catch (Exception e)
        {
        }
View Full Code Here

        //Does not exist on either
        assertNull(c.getQuery(testJdbcEndpoint, "getTest4"));
        assertEquals("3", testJdbcEndpoint.getProperty("queryTimeout"));
       
        QueryRunner queryRunner = c.getQueryRunnerFor(testJdbcEndpoint);
        assertEquals(ExtendedQueryRunner.class, queryRunner.getClass());
        assertEquals(3, ((ExtendedQueryRunner) queryRunner).getQueryTimeout());
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.dbutils.QueryRunner

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.