Examples of prepareStatement()


Examples of fi.luomus.commons.db.connectivity.PreparedStatementStoringAndClosingTransactionConnection.prepareStatement()

        dao.close();
    }

    private List<SavedDocument> getFiles() throws Exception {
        TransactionConnection con = new PreparedStatementStoringAndClosingTransactionConnection(description);
        PreparedStatement query = con.prepareStatement("SELECT * FROM ETL.XMLFile");
        ResultSet rs = query.executeQuery();

        List<SavedDocument> savedDocuments = new ArrayList<SavedDocument>();
        while (rs.next()) {
            savedDocuments.add(new SavedDocument(rs.getString("DocumentID"),
View Full Code Here

Examples of fi.luomus.commons.db.connectivity.TransactionConnection.prepareStatement()

        dao.close();
    }

    private List<SavedDocument> getFiles() throws Exception {
        TransactionConnection con = new PreparedStatementStoringAndClosingTransactionConnection(description);
        PreparedStatement query = con.prepareStatement("SELECT * FROM ETL.XMLFile");
        ResultSet rs = query.executeQuery();

        List<SavedDocument> savedDocuments = new ArrayList<SavedDocument>();
        while (rs.next()) {
            savedDocuments.add(new SavedDocument(rs.getString("DocumentID"),
View Full Code Here

Examples of java.sql.Connection.prepareStatement()

    ResultSet rs = null;
    try{
      //ps = conn.prepareStatement("create table dlog_bookmark (markid INTEGER,logid INTEGER,siteid INTEGER,userid INTEGER,marktype INTEGER,createTime DATE,markorder INTEGER);");
      //ps.executeUpdate();
     
      ps = conn.prepareStatement("SELECT * FROM dlog_user");
      rs = ps.executeQuery();
      while(rs.next()){
        System.out.println(rs.getString("displayName"));
      }
    }finally{
View Full Code Here

Examples of java.sql.Connection.prepareStatement()

        Task[] tasks = new Task[len];
        for (int i = 0; i < len; i++) {
            tasks[i] = new Task() {
                public void call() throws SQLException {
                    Connection c = DriverManager.getConnection(url, user, password);
                    PreparedStatement prep = c.prepareStatement("insert into employee values(?, ?, 0)");
                    int id = getNextId();
                    prep.setInt(1, id);
                    prep.setString(2, "employee " + id);
                    prep.execute();
                    c.close();
View Full Code Here

Examples of java.sql.Connection.prepareStatement()

    private void testPrecision() throws SQLException {
        Connection conn = getConnection("functions");
        Statement stat = conn.createStatement();
        stat.execute("create alias no_op for \""+getClass().getName()+".noOp\"");
        PreparedStatement prep = conn.prepareStatement("select * from dual where no_op(1.6)=?");
        prep.setBigDecimal(1, new BigDecimal("1.6"));
        ResultSet rs = prep.executeQuery();
        assertTrue(rs.next());

        stat.execute("create aggregate agg_sum for \""+getClass().getName()+"\"");
View Full Code Here

Examples of java.sql.Connection.prepareStatement()

        ResultSet rs;
        stat.execute("create alias array_test AS "
                + "$$ Integer[] array_test(Integer[] in_array) "
                + "{ return in_array; } $$;");

        PreparedStatement stmt = conn.prepareStatement("select array_test(?) from dual");
        stmt.setObject(1, new Integer[] { 1, 2 });
        rs = stmt.executeQuery();
        rs.next();
        assertEquals(Integer[].class.getName(), rs.getObject(1).getClass().getName());
View Full Code Here

Examples of java.sql.Connection.prepareStatement()

        rs = stat.executeQuery("execute test(3, 2)");
        rs.next();
        assertEquals(6, rs.getInt(1));
        stat.execute("deallocate test");

        PreparedStatement prep = conn.prepareStatement("insert into test values(?, ?)");
        ParameterMetaData meta = prep.getParameterMetaData();
        assertEquals(2, meta.getParameterCount());
        prep.setInt(1, 1);
        prep.setString(2, "Hello");
        prep.execute();
View Full Code Here

Examples of java.sql.Connection.prepareStatement()

        prep.close();
        assertEquals(1, rs.getInt(1));
        assertEquals("Hello", rs.getString(2));
        assertFalse(rs.next());
        prep = conn.prepareStatement("select * from test where id = ? and name = ?");
        prep.setInt(1, 1);
        prep.setString(2, "Hello");
        rs = prep.executeQuery();
        rs.next();
        assertEquals(1, rs.getInt(1));
View Full Code Here

Examples of java.sql.Connection.prepareStatement()

        // long time = System.currentTimeMillis();

        stat.execute("DROP TABLE IF EXISTS TEST");
        stat.execute("CREATE CACHED TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255))");
        PreparedStatement prep = conn.prepareStatement("INSERT INTO TEST VALUES(?, ?)");

        int max = getSize(1, 10000);
        for (int i = 0; i < max; i++) {
            prep.setInt(1, i);
            prep.setString(2,
View Full Code Here

Examples of java.sql.Connection.prepareStatement()

        // conn.close();

        time = System.currentTimeMillis();

        prep = conn.prepareStatement("UPDATE TEST SET NAME='Another data row which is long' WHERE ID=?");
        for (int i = 0; i < max; i++) {
            prep.setInt(1, i);
            prep.execute();

            // System.out.println("updated "+i);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.