Package java.sql

Examples of java.sql.Connection.createStatement()


    private void testAddDelete() throws SQLException {
        deleteDb("index");
        Connection conn = getConnection("index");
        try {
            Statement stat = conn.createStatement();
            stat.execute("CREATE TABLE TEST(ID bigint primary key)");
            int count = 1000;
            stat.execute("insert into test select x from system_range(1, " + count + ")");
            if (!config.memory) {
                conn.close();
View Full Code Here


            return;
        }
        deleteDb("lob");
        Connection conn;
        conn = getConnection("lob");
        Statement stat = conn.createStatement();
        stat.execute("create table test(id int, name clob)");
        assertThrows(ErrorCode.FEATURE_NOT_SUPPORTED_1, stat).
                execute("create index idx_n on test(name)");
        stat.execute("drop table test");
        conn.close();
View Full Code Here

            int count = 1000;
            stat.execute("insert into test select x from system_range(1, " + count + ")");
            if (!config.memory) {
                conn.close();
                conn = getConnection("index");
                stat = conn.createStatement();
            }
            for (int i = 1; i < count; i++) {
                ResultSet rs = stat.executeQuery("select * from test order by id");
                for (int j = i; rs.next(); j++) {
                    assertEquals(j, rs.getInt(1));
View Full Code Here

    private void testBlobInputStreamSeek(boolean upgraded) throws Exception {
        deleteDb("lob");
        Connection conn;
        conn = getConnection("lob");
        Statement stat = conn.createStatement();
        stat.execute("create table test(id int primary key, data blob)");
        PreparedStatement prep;
        Random random = new Random();
        byte[] buff = new byte[500000];
        for (int i = 0; i < 10; i++) {
View Full Code Here

        }
        String prefix = buff.toString().substring(0, prefixLength);
        DeleteDbFiles.execute(getBaseDir() + "/index", null, true);
        Connection conn = getConnection("index");
        try {
            Statement stat = conn.createStatement();
            stat.execute("CREATE TABLE a(text VARCHAR PRIMARY KEY)");
            PreparedStatement prepInsert = conn.prepareStatement("INSERT INTO a VALUES(?)");
            PreparedStatement prepDelete = conn.prepareStatement("DELETE FROM a WHERE text=?");
            PreparedStatement prepDeleteAllButOne = conn.prepareStatement("DELETE FROM a WHERE text <> ?");
            int count = 0;
View Full Code Here

                }
            }
            int testCount;
            testCount = 0;
            ResultSet rs = stat.executeQuery("SELECT text FROM a ORDER BY text");
            ResultSet rs2 = conn.createStatement().executeQuery("SELECT text FROM a ORDER BY 'x' || text");

//System.out.println("-----------");
//while(rs.next()) {
//    System.out.println(rs.getString(1));
//}
View Full Code Here

     * Test for issue 315: Java Level Deadlock on Database & Session Objects
     */
    private void testDeadlock() throws Exception {
        deleteDb("lob");
        Connection conn = getConnection("lob");
        Statement stat = conn.createStatement();
        stat.execute("create table test(id int primary key, name clob)");
        stat.execute("insert into test select x, space(10000) from system_range(1, 3)");
        final Connection conn2 = getConnection("lob");
        Task task = new Task() {

View Full Code Here

        stat.execute("insert into test select x, space(10000) from system_range(1, 3)");
        final Connection conn2 = getConnection("lob");
        Task task = new Task() {

            public void call() throws Exception {
                Statement stat = conn2.createStatement();
                stat.setFetchSize(1);
                for (int i = 0; !stop; i++) {
                    ResultSet rs = stat.executeQuery("select * from test where id > -" + i);
                    while (rs.next()) {
                        // ignore
View Full Code Here

    }

    private void testCopyManyLobs() throws Exception {
        deleteDb("lob");
        Connection conn = getConnection("lob");
        Statement stat = conn.createStatement();
        stat.execute("create table test(id identity, data clob) as select 1, space(10000)");
        stat.execute("insert into test(id, data) select null, data from test");
        stat.execute("insert into test(id, data) select null, data from test");
        stat.execute("insert into test(id, data) select null, data from test");
        stat.execute("insert into test(id, data) select null, data from test");
View Full Code Here

        deleteDb("lob");
        Connection conn;
        Statement stat;
        ResultSet rs;
        conn = getConnection("lob");
        stat = conn.createStatement();
        stat.execute("create table test(id identity, data clob) as select 1, space(10000)");
        stat.execute("insert into test(id, data) select 2, data from test");
        stat.execute("delete from test where id = 1");
        conn.close();
        conn = getConnection("lob");
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.