Package java.sql

Examples of java.sql.Statement.execute()


        assertTrue(rs.getString("XTI") == null && rs.wasNull());
        assertTrue(rs.getString("XCL") == null && rs.wasNull());
        assertTrue(rs.getString("XDO") == null && rs.wasNull());
        assertFalse(rs.next());

        stat.execute("DROP TABLE LINK_TEST");

        stat.execute("CREATE LINKED TABLE LINK_TEST('org.h2.Driver', '" + url1
                + "', 'sa1', 'abc abc', '(SELECT COUNT(*) FROM TEST)')");
        rs = stat.executeQuery("SELECT * FROM LINK_TEST");
        rs.next();
View Full Code Here


        assertTrue(rs.getString("XDO") == null && rs.wasNull());
        assertFalse(rs.next());

        stat.execute("DROP TABLE LINK_TEST");

        stat.execute("CREATE LINKED TABLE LINK_TEST('org.h2.Driver', '" + url1
                + "', 'sa1', 'abc abc', '(SELECT COUNT(*) FROM TEST)')");
        rs = stat.executeQuery("SELECT * FROM LINK_TEST");
        rs.next();
        assertEquals(3, rs.getInt(1));
        assertFalse(rs.next());
View Full Code Here

        Statement sa = ca.createStatement();
        Statement sb = cb.createStatement();
        sa.execute("CREATE TABLE TEST(ID VARCHAR)");
        sa.execute("INSERT INTO TEST (ID) VALUES('abc')");
        sb.execute("CREATE LOCAL TEMPORARY LINKED TABLE T(NULL, 'jdbc:h2:mem:one', 'sa', 'sa', 'TEST')");

        PreparedStatement paData = ca.prepareStatement("select id from TEST where id = ?");
        PreparedStatement pbData = cb.prepareStatement("select id from T where id = ?");
        PreparedStatement paCount = ca.prepareStatement("select count(*) from TEST");
        PreparedStatement pbCount = cb.prepareStatement("select count(*) from T");
View Full Code Here

        deleteDb("testLinkedTableInReadOnlyDb");
        org.h2.Driver.load();

        Connection memConn = DriverManager.getConnection("jdbc:h2:mem:one", "sa", "sa");
        Statement memStat = memConn.createStatement();
        memStat.execute("CREATE TABLE TEST(ID VARCHAR)");

        String url1 = getURL("testLinkedTableInReadOnlyDb", true);
        Connection conn = DriverManager.getConnection(url1, "sa1", "abc abc");
        Statement stat = conn.createStatement();
        stat.execute("CREATE TABLE TEST(ID INT PRIMARY KEY)");
View Full Code Here

        memStat.execute("CREATE TABLE TEST(ID VARCHAR)");

        String url1 = getURL("testLinkedTableInReadOnlyDb", true);
        Connection conn = DriverManager.getConnection(url1, "sa1", "abc abc");
        Statement stat = conn.createStatement();
        stat.execute("CREATE TABLE TEST(ID INT PRIMARY KEY)");
        conn.close();

        String[] files = IOUtils.listFiles(getBaseDir());
        for (String file : files) {
            String name = IOUtils.getFileName(file);
View Full Code Here

        }

        // Now it's read only
        conn = DriverManager.getConnection(url1, "sa1", "abc abc");
        stat = conn.createStatement();
        stat.execute("CREATE LOCAL TEMPORARY LINKED TABLE T(NULL, 'jdbc:h2:mem:one', 'sa', 'sa', 'TEST')");
        // This is valid because it's a linked table
        stat.execute("INSERT INTO T VALUES('abc')");

        conn.close();
        memConn.close();
View Full Code Here

        // Now it's read only
        conn = DriverManager.getConnection(url1, "sa1", "abc abc");
        stat = conn.createStatement();
        stat.execute("CREATE LOCAL TEMPORARY LINKED TABLE T(NULL, 'jdbc:h2:mem:one', 'sa', 'sa', 'TEST')");
        // This is valid because it's a linked table
        stat.execute("INSERT INTO T VALUES('abc')");

        conn.close();
        memConn.close();

        deleteDb("testLinkedTableInReadOnlyDb");
View Full Code Here

   private void stopStandaloneDatabase() throws Exception
   {
       try
       {
           final Statement stmt = connection.createStatement() ;
           stmt.execute("shutdown") ;
       }
       finally
       {
           connection = null;
       }
View Full Code Here

    try {
      // Creating a statement lets us issue commands against the connection.
      Statement s = conn.createStatement();

      // We create the table.
      s.execute("CREATE TABLE JoramDB (name VARCHAR(256), content LONG VARCHAR FOR BIT DATA, PRIMARY KEY(name))");

      s.close();
      conn.commit();
    } catch (SQLException sqle) {
      if (logmon.isLoggable(BasicLevel.INFO))
View Full Code Here

            stat = conn.createStatement();
            rs = stat.executeQuery("call sayHi('Joe')");
            rs.next();
            assertEquals("Hello Joe", rs.getString(1));
        }
        stat.execute("drop alias sayHi");
        conn.close();
    }

    private void testDynamicArgumentAndReturn() throws SQLException {
        Connection conn = getConnection("functions");
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.