Search in sources :

Example 36 with SQLFeatureNotSupportedException

use of java.sql.SQLFeatureNotSupportedException in project druid by alibaba.

the class DruidDataSourceC3P0AdapterTest method test_getParentLogger_err.

public void test_getParentLogger_err() throws Exception {
    Exception error = null;
    try {
        dataSource.getParentLogger();
    } catch (SQLFeatureNotSupportedException e) {
        error = e;
    }
    Assert.assertNotNull(error);
}
Also used : SQLFeatureNotSupportedException(java.sql.SQLFeatureNotSupportedException) SQLFeatureNotSupportedException(java.sql.SQLFeatureNotSupportedException)

Example 37 with SQLFeatureNotSupportedException

use of java.sql.SQLFeatureNotSupportedException in project druid by alibaba.

the class DruidPooledStatementTest method test_closeOnCompletion_error.

public void test_closeOnCompletion_error() throws Exception {
    Connection conn = dataSource.getConnection();
    DruidPooledStatement stmt = (DruidPooledStatement) conn.createStatement();
    Assert.assertEquals(0, dataSource.getPoolingCount());
    Assert.assertEquals(1, dataSource.getActiveCount());
    Assert.assertEquals(0, dataSource.getErrorCount());
    Exception error = null;
    try {
        stmt.closeOnCompletion();
    } catch (SQLFeatureNotSupportedException e) {
        error = e;
    }
    Assert.assertNotNull(error);
    Assert.assertEquals(0, dataSource.getErrorCount());
    stmt.close();
    conn.close();
    Assert.assertEquals(1, dataSource.getPoolingCount());
    Assert.assertEquals(0, dataSource.getActiveCount());
}
Also used : DruidPooledStatement(com.alibaba.druid.pool.DruidPooledStatement) SQLFeatureNotSupportedException(java.sql.SQLFeatureNotSupportedException) Connection(java.sql.Connection) SQLFeatureNotSupportedException(java.sql.SQLFeatureNotSupportedException) SQLException(java.sql.SQLException)

Example 38 with SQLFeatureNotSupportedException

use of java.sql.SQLFeatureNotSupportedException in project druid by alibaba.

the class StatementTest method test_stmt.

public void test_stmt() throws Exception {
    Connection conn = null;
    Statement stmt = null;
    ResultSet rs = null;
    try {
        conn = DriverManager.getConnection(create_url);
        stmt = conn.createStatement();
        stmt.execute("INSERT INTO T_PRE_STMT_TEST (ID, NAME, BIRTHDATE) VALUES (1, 'A', NULL)");
        stmt.execute("INSERT INTO T_PRE_STMT_TEST (ID, NAME, BIRTHDATE) VALUES (11, 'A1', NULL)", Statement.NO_GENERATED_KEYS);
        stmt.execute("INSERT INTO T_PRE_STMT_TEST (ID, NAME, BIRTHDATE) VALUES (12, 'A2', NULL)", new int[] { 1 });
        stmt.execute("INSERT INTO T_PRE_STMT_TEST (ID, NAME, BIRTHDATE) VALUES (12, 'A3', NULL)", new String[] { "ID" });
        stmt.executeUpdate("INSERT INTO T_PRE_STMT_TEST (ID, NAME, BIRTHDATE) VALUES (2, 'B', NULL)");
        stmt.executeUpdate("INSERT INTO T_PRE_STMT_TEST (ID, NAME, BIRTHDATE) VALUES (3, 'C', NULL)", Statement.NO_GENERATED_KEYS);
        stmt.executeUpdate("INSERT INTO T_PRE_STMT_TEST (ID, NAME, BIRTHDATE) VALUES (4, 'D', NULL)", new int[] { 1 });
        stmt.executeUpdate("INSERT INTO T_PRE_STMT_TEST (ID, NAME, BIRTHDATE) VALUES (5, 'E', NULL)", new String[] { "ID" });
        try {
            stmt.cancel();
        } catch (SQLFeatureNotSupportedException ex) {
        }
        stmt.execute("SELECT * FROM T_PRE_STMT_TEST");
        Assert.assertFalse(stmt.getMoreResults(Statement.CLOSE_CURRENT_RESULT));
    } finally {
        JdbcUtils.close(rs);
        JdbcUtils.close(stmt);
        JdbcUtils.close(conn);
    }
}
Also used : SQLFeatureNotSupportedException(java.sql.SQLFeatureNotSupportedException) Statement(java.sql.Statement) Connection(java.sql.Connection) ResultSet(java.sql.ResultSet)

Example 39 with SQLFeatureNotSupportedException

use of java.sql.SQLFeatureNotSupportedException in project druid by alibaba.

the class DruidPooledCallableStatementTest method test_getObject.

public void test_getObject() throws Exception {
    Connection conn = dataSource.getConnection();
    DruidPooledCallableStatement stmt = (DruidPooledCallableStatement) conn.prepareCall("select 1");
    stmt.execute();
    Assert.assertEquals(0, dataSource.getErrorCount());
    Exception error = null;
    try {
        stmt.getObject(1, String.class);
    } catch (SQLFeatureNotSupportedException e) {
        error = e;
    }
    Assert.assertNotNull(error);
    Assert.assertEquals(0, dataSource.getErrorCount());
    stmt.close();
    conn.close();
    Assert.assertEquals(1, dataSource.getPoolingCount());
}
Also used : DruidPooledCallableStatement(com.alibaba.druid.pool.DruidPooledCallableStatement) SQLFeatureNotSupportedException(java.sql.SQLFeatureNotSupportedException) Connection(java.sql.Connection) SQLFeatureNotSupportedException(java.sql.SQLFeatureNotSupportedException) SQLException(java.sql.SQLException)

Example 40 with SQLFeatureNotSupportedException

use of java.sql.SQLFeatureNotSupportedException in project druid by alibaba.

the class BasicTypeTest method test_basicType.

@SuppressWarnings("deprecation")
public void test_basicType() throws Exception {
    Connection conn = null;
    PreparedStatement pstmt = null;
    CallableStatement cstmt = null;
    Statement stmt = null;
    ResultSet rs = null;
    try {
        conn = DriverManager.getConnection(create_url);
        conn.rollback();
        pstmt = conn.prepareStatement("INSERT INTO T_BASIC_TYPE (F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17) VALUES (?, ?, ?, ?, ?,	?, ?, ?, ?, ?,	?, ?, ?,?, ?, 	?, ?)");
        pstmt.getParameterMetaData();
        pstmt.setFloat(1, 1F);
        pstmt.setDouble(2, 2.1D);
        pstmt.setFloat(3, 2.1F);
        pstmt.setDate(4, new java.sql.Date(System.currentTimeMillis()));
        pstmt.setDate(4, new java.sql.Date(System.currentTimeMillis()), Calendar.getInstance());
        pstmt.setTime(5, new java.sql.Time(System.currentTimeMillis()));
        pstmt.setTime(5, new java.sql.Time(System.currentTimeMillis()), Calendar.getInstance());
        pstmt.setByte(6, (byte) 33);
        pstmt.setShort(7, (short) 44);
        pstmt.setInt(8, 55);
        pstmt.setLong(9, 66);
        pstmt.setBigDecimal(10, new BigDecimal("77"));
        pstmt.setTimestamp(11, new java.sql.Timestamp(System.currentTimeMillis()));
        pstmt.setTimestamp(11, new java.sql.Timestamp(System.currentTimeMillis()), Calendar.getInstance());
        pstmt.setBytes(12, new byte[100]);
        pstmt.setAsciiStream(13, null);
        pstmt.setAsciiStream(14, null, 0);
        pstmt.setAsciiStream(14, null, 0L);
        pstmt.setCharacterStream(15, null);
        pstmt.setCharacterStream(16, null, 0);
        pstmt.setCharacterStream(16, null, 0L);
        pstmt.setNull(16, Types.VARCHAR);
        pstmt.setNull(16, Types.VARCHAR, "VARCHAR");
        pstmt.setObject(16, null, Types.VARCHAR);
        pstmt.setObject(16, null, Types.VARCHAR, 0);
        pstmt.setBoolean(17, true);
        pstmt.execute();
        pstmt.clearParameters();
        JdbcUtils.close(pstmt);
        stmt = conn.createStatement();
        stmt.close();
        stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
        stmt.close();
        stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE, ResultSet.CLOSE_CURSORS_AT_COMMIT);
        stmt.setQueryTimeout(stmt.getQueryTimeout());
        stmt.setEscapeProcessing(true);
        stmt.clearBatch();
        stmt.clearWarnings();
        stmt.setCursorName("demo_cur");
        conn.setAutoCommit(false);
        Savepoint point = conn.setSavepoint();
        point = conn.setSavepoint("save_point");
        rs = stmt.executeQuery("SELECT F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17 FROM T_BASIC_TYPE");
        rs.next();
        rs.getFloat(1);
        rs.getDouble(2);
        rs.getFloat(3);
        rs.getDate(4);
        rs.getDate(4, Calendar.getInstance());
        rs.getTime(5);
        rs.getTime(5, Calendar.getInstance());
        rs.getByte(6);
        rs.getShort(7);
        rs.getInt(8);
        rs.getLong(9);
        rs.getBigDecimal(10);
        rs.getBigDecimal(10, 2);
        rs.getTimestamp(11);
        rs.getTimestamp(11, Calendar.getInstance());
        rs.getBytes(12);
        rs.getBlob(12).free();
        rs.getString(13);
        rs.getAsciiStream(13);
        rs.getCharacterStream(14);
        rs.getObject(15, new HashMap<String, Class<?>>());
        rs.getHoldability();
        rs.updateFloat(1, 2F);
        rs.updateDouble(2, 2D);
        rs.updateDate(4, new java.sql.Date(System.currentTimeMillis()));
        rs.updateTime(5, new java.sql.Time(System.currentTimeMillis()));
        rs.updateByte(6, (byte) 6);
        rs.updateShort(7, (short) 77);
        rs.updateInt(8, 77);
        rs.updateLong(9, 99);
        rs.updateBigDecimal(10, new BigDecimal("10"));
        rs.updateTimestamp(11, new java.sql.Timestamp(System.currentTimeMillis()));
        rs.updateBytes(12, new byte[300]);
        rs.updateBinaryStream(12, null);
        rs.updateBinaryStream(12, null, 0);
        rs.updateBinaryStream(12, null, 0L);
        rs.updateString(13, "13x");
        rs.updateAsciiStream(13, null);
        rs.updateAsciiStream(13, null, 0);
        rs.updateAsciiStream(13, null, 0L);
        rs.updateCharacterStream(14, null);
        rs.updateCharacterStream(14, null, 0);
        rs.updateCharacterStream(14, null, 0L);
        rs.updateNull(14);
        rs.updateObject(15, "object");
        rs.updateObject(15, "object", 0);
        rs.updateBoolean(17, false);
        rs.updateRow();
        JdbcUtils.close(rs);
        //            conn.rollback(point);
        conn.setAutoCommit(true);
        rs = stmt.executeQuery("SELECT F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17 FROM T_BASIC_TYPE");
        rs.next();
        rs.getFloat("F1");
        rs.getDouble("F2");
        rs.getFloat("F3");
        rs.getDate("F4");
        rs.getDate("F4", Calendar.getInstance());
        rs.getTime("F5");
        rs.getTime("F5", Calendar.getInstance());
        rs.getByte("F6");
        rs.getShort("F7");
        rs.getInt("F8");
        rs.getLong("F9");
        rs.getBigDecimal("F10");
        rs.getBigDecimal("F10", 2);
        rs.getTimestamp("F11");
        rs.getTimestamp("F11", Calendar.getInstance());
        rs.getBytes("F12");
        rs.getBlob("F12");
        rs.getString("F13");
        rs.getAsciiStream("F13");
        rs.getCharacterStream("F14");
        rs.getObject("F15", new HashMap<String, Class<?>>());
        rs.updateFloat("F1", 2F);
        rs.updateDouble("F2", 2D);
        rs.updateDate("F4", new java.sql.Date(System.currentTimeMillis()));
        rs.updateTime("F5", new java.sql.Time(System.currentTimeMillis()));
        rs.updateByte("F6", (byte) 6);
        rs.updateShort("F7", (short) 77);
        rs.updateInt("F8", 77);
        rs.updateLong("F9", 99);
        rs.updateBigDecimal("F10", new BigDecimal("10"));
        rs.updateTimestamp("F11", new java.sql.Timestamp(System.currentTimeMillis()));
        rs.updateBytes("F12", new byte[300]);
        rs.updateBinaryStream("F12", null);
        rs.updateBinaryStream("F12", null, 0);
        rs.updateBinaryStream("F12", null, 0L);
        rs.updateString("F13", "13x");
        rs.updateAsciiStream("F13", null);
        rs.updateAsciiStream("F13", null, 0);
        rs.updateAsciiStream("F13", null, 0L);
        rs.updateCharacterStream("F14", null);
        rs.updateCharacterStream("F14", null, 0);
        rs.updateCharacterStream("F14", null, 0L);
        rs.updateNull("F14");
        rs.updateObject("F15", "object");
        rs.updateObject("F15", "object", 0);
        rs.updateBoolean("F17", false);
        rs.cancelRowUpdates();
        rs.deleteRow();
        Assert.assertEquals(12, rs.findColumn("F12"));
        JdbcUtils.close(rs);
        pstmt = conn.prepareStatement("SELECT F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16 FROM T_BASIC_TYPE");
        JdbcUtils.close(pstmt);
        pstmt = conn.prepareStatement("SELECT F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16 FROM T_BASIC_TYPE", new int[] { 1, 2 });
        JdbcUtils.close(pstmt);
        pstmt = conn.prepareStatement("SELECT F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16 FROM T_BASIC_TYPE", new String[] { "F1", "F2" });
        JdbcUtils.close(pstmt);
        pstmt = conn.prepareStatement("SELECT F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16 FROM T_BASIC_TYPE", Statement.RETURN_GENERATED_KEYS);
        JdbcUtils.close(pstmt);
        pstmt = conn.prepareStatement("SELECT F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16 FROM T_BASIC_TYPE", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
        pstmt.executeQuery().close();
        JdbcUtils.close(pstmt);
        pstmt = conn.prepareStatement("SELECT F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16 FROM T_BASIC_TYPE", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE, ResultSet.CLOSE_CURSORS_AT_COMMIT);
        JdbcUtils.close(pstmt);
        cstmt = conn.prepareCall("CALL BASIC_CALL_0(?, ?, ?, ?, ?,	?, ?, ?, ?, ?,	?, ?, ?,?, ?, 	?, ?)");
        cstmt.registerOutParameter(1, Types.FLOAT);
        cstmt.registerOutParameter(2, Types.DOUBLE);
        cstmt.registerOutParameter(3, Types.FLOAT);
        cstmt.registerOutParameter(4, Types.DATE);
        cstmt.registerOutParameter(5, Types.TIME);
        cstmt.registerOutParameter(6, Types.TINYINT);
        cstmt.registerOutParameter(7, Types.SMALLINT);
        cstmt.registerOutParameter(8, Types.INTEGER);
        cstmt.registerOutParameter(9, Types.BIGINT);
        cstmt.registerOutParameter(10, Types.DECIMAL);
        cstmt.registerOutParameter(10, Types.DECIMAL, 2);
        try {
            cstmt.registerOutParameter(10, Types.DECIMAL, "DECIMAL");
        } catch (SQLFeatureNotSupportedException ex) {
        }
        cstmt.registerOutParameter(11, Types.TIMESTAMP);
        cstmt.registerOutParameter(12, Types.BINARY);
        cstmt.registerOutParameter(13, Types.VARCHAR);
        cstmt.registerOutParameter(14, Types.VARCHAR);
        cstmt.registerOutParameter(15, Types.VARCHAR);
        cstmt.registerOutParameter(16, Types.VARCHAR);
        cstmt.registerOutParameter(17, Types.BOOLEAN);
        //
        try {
            cstmt.registerOutParameter("F2", Types.DECIMAL);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.registerOutParameter("F2", Types.DECIMAL, 2);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.registerOutParameter("F2", Types.DECIMAL, "DECIMAL");
        } catch (SQLFeatureNotSupportedException ex) {
        }
        // cstmt.registerOutParameter(18, Types.OTHER);
        cstmt.setFloat(1, 1F);
        cstmt.setDouble(2, 2.1D);
        cstmt.setFloat(3, 2.1F);
        cstmt.setDate(4, new java.sql.Date(System.currentTimeMillis()));
        cstmt.setDate(4, new java.sql.Date(System.currentTimeMillis()), Calendar.getInstance());
        cstmt.setTime(5, new java.sql.Time(System.currentTimeMillis()));
        cstmt.setTime(5, new java.sql.Time(System.currentTimeMillis()), Calendar.getInstance());
        cstmt.setByte(6, (byte) 33);
        cstmt.setShort(7, (short) 44);
        cstmt.setInt(8, 55);
        cstmt.setLong(9, 66);
        cstmt.setBigDecimal(10, new BigDecimal("77"));
        cstmt.setTimestamp(11, new java.sql.Timestamp(System.currentTimeMillis()));
        cstmt.setTimestamp(11, new java.sql.Timestamp(System.currentTimeMillis()), Calendar.getInstance());
        cstmt.setBinaryStream(12, null);
        cstmt.setBinaryStream(12, null, 0);
        cstmt.setBinaryStream(12, null, 0L);
        cstmt.setBytes(12, new byte[100]);
        cstmt.setAsciiStream(13, null);
        cstmt.setAsciiStream(14, null, 0);
        cstmt.setAsciiStream(14, null, 0L);
        cstmt.setString(15, null);
        cstmt.setCharacterStream(15, null);
        cstmt.setCharacterStream(16, null, 0);
        cstmt.setCharacterStream(16, null, 0L);
        cstmt.setNull(16, Types.VARCHAR);
        cstmt.setObject(16, null, Types.VARCHAR);
        cstmt.setBoolean(17, true);
        try {
            cstmt.setFloat("F1", 1F);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.setDouble("F2", 2.1D);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.setFloat("F3", 2.1F);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.setDate("F4", new java.sql.Date(System.currentTimeMillis()));
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.setDate("F4", new java.sql.Date(System.currentTimeMillis()), Calendar.getInstance());
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.setTime("F5", new java.sql.Time(System.currentTimeMillis()));
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.setTime("F5", new java.sql.Time(System.currentTimeMillis()), Calendar.getInstance());
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.setByte("F6", (byte) 33);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.setShort("F7", (short) 44);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.setInt("F8", 55);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.setLong("F9", 66);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.setBigDecimal("F10", new BigDecimal("77"));
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.setTimestamp("F11", new java.sql.Timestamp(System.currentTimeMillis()));
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.setTimestamp("F11", new java.sql.Timestamp(System.currentTimeMillis()), Calendar.getInstance());
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.setBytes("F12", new byte[100]);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.setBinaryStream("F12", null);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.setBinaryStream("F12", null, 0);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.setBinaryStream("F12", null, 0L);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.setAsciiStream("F13", null);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.setAsciiStream("F14", null, 0);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.setAsciiStream("F14", null, 0L);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.setCharacterStream("F15", null);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.setCharacterStream("F16", null, 0);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.setCharacterStream("F16", null, 0L);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.setString("F16", null);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.setObject("F16", null);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.setObject("F16", null, Types.VARCHAR);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.setNull("F16", Types.VARCHAR);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.setBoolean("F17", true);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        cstmt.execute();
        try {
            cstmt.getFloat(1);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getDouble(2);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getFloat(3);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getDate(4);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getDate(4, Calendar.getInstance());
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getTime(5);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getTime(5, Calendar.getInstance());
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getByte(6);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getShort(7);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getInt(8);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getLong(9);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getBigDecimal(10);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getBigDecimal(10, 2);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getTimestamp(11);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getTimestamp(11, Calendar.getInstance());
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getBytes(12);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getBlob(12).free();
        } catch (SQLException ex) {
        }
        try {
            cstmt.getString(13);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getCharacterStream(14);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getObject(15);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getObject(15, new HashMap<String, Class<?>>());
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getBoolean(17);
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getFloat("F1");
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getDouble("F2");
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getFloat("F3");
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getDate("F4");
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getDate("F4", Calendar.getInstance());
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getTime("F5");
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getTime("F5", Calendar.getInstance());
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getByte("F6");
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getShort("F7");
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getInt("F8");
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getLong("F9");
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getBigDecimal("F10");
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getTimestamp("F11");
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getTimestamp("F11", Calendar.getInstance());
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getBytes("F12");
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getBlob("F12").free();
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getString("F13");
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getCharacterStream("F14");
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getObject("F15");
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getObject("F15", new HashMap<String, Class<?>>());
        } catch (SQLFeatureNotSupportedException ex) {
        }
        try {
            cstmt.getBoolean("F17");
        } catch (SQLFeatureNotSupportedException ex) {
        }
        cstmt.wasNull();
    } finally {
        JdbcUtils.close(rs);
        JdbcUtils.close(stmt);
        JdbcUtils.close(pstmt);
        JdbcUtils.close(cstmt);
        JdbcUtils.close(conn);
    }
}
Also used : SQLFeatureNotSupportedException(java.sql.SQLFeatureNotSupportedException) SQLException(java.sql.SQLException) PreparedStatement(java.sql.PreparedStatement) Statement(java.sql.Statement) CallableStatement(java.sql.CallableStatement) Connection(java.sql.Connection) PreparedStatement(java.sql.PreparedStatement) Savepoint(java.sql.Savepoint) BigDecimal(java.math.BigDecimal) CallableStatement(java.sql.CallableStatement) ResultSet(java.sql.ResultSet)

Aggregations

SQLFeatureNotSupportedException (java.sql.SQLFeatureNotSupportedException)55 SQLException (java.sql.SQLException)20 Connection (java.sql.Connection)14 Test (org.testng.annotations.Test)14 BaseTest (util.BaseTest)14 PreparedStatement (java.sql.PreparedStatement)13 Statement (java.sql.Statement)11 ResultSet (java.sql.ResultSet)10 Test (org.junit.Test)5 Properties (java.util.Properties)4 CallableStatement (java.sql.CallableStatement)3 DruidPooledCallableStatement (com.alibaba.druid.pool.DruidPooledCallableStatement)2 DruidPooledResultSet (com.alibaba.druid.pool.DruidPooledResultSet)2 DruidPooledStatement (com.alibaba.druid.pool.DruidPooledStatement)2 Date (java.sql.Date)2 SQLDataException (java.sql.SQLDataException)2 Savepoint (java.sql.Savepoint)2 Vector (java.util.Vector)2 ColumnInfo (org.apache.jena.jdbc.results.metadata.columns.ColumnInfo)2 SparqlColumnInfo (org.apache.jena.jdbc.results.metadata.columns.SparqlColumnInfo)2