示例#1
0
  public void test_releaseSavepoint_1() throws Exception {
    DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);

    conn.getConnection().close();
    {
      SQLException error = null;
      try {
        conn.releaseSavepoint(null);
      } catch (SQLException ex) {
        error = ex;
      }
      Assert.assertNotNull(error);
    }

    conn.close();
  }
示例#2
0
  public void test_basic() throws Exception {
    DruidPooledConnection conn = (DruidPooledConnection) dataSource.getConnection();

    conn.getTransactionInfo();
    conn.getMetaData();
    conn.setReadOnly(true);
    Assert.assertEquals(true, conn.isReadOnly());

    conn.setCatalog("xxx");
    Assert.assertEquals("xxx", conn.getCatalog());

    conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
    Assert.assertEquals(Connection.TRANSACTION_READ_COMMITTED, conn.getTransactionIsolation());

    conn.getWarnings();
    conn.clearWarnings();
    conn.getTypeMap();
    conn.setTypeMap(null);

    conn.setHoldability(ResultSet.CLOSE_CURSORS_AT_COMMIT);
    Assert.assertEquals(ResultSet.CLOSE_CURSORS_AT_COMMIT, conn.getHoldability());

    conn.setSavepoint();
    conn.setSavepoint("savepoint");
    conn.rollback();
    {
      Exception error = null;
      try {
        conn.rollback(null);
      } catch (SQLException e) {
        error = e;
      }
      Assert.assertNotNull(error);
    }
    {
      Exception error = null;
      try {
        conn.releaseSavepoint(null);
      } catch (SQLException e) {
        error = e;
      }
      Assert.assertNotNull(error);
    }
    conn.createBlob();
    conn.createClob();
    conn.createNClob();
    conn.createSQLXML();
    conn.isValid(200);
    conn.setClientInfo(new Properties());
    conn.setClientInfo("xx", "11");
    conn.getClientInfo("xx");
    conn.getClientInfo();

    conn.createArrayOf("int", new Object[0]);
    conn.createStruct("int", new Object[0]);

    conn.addConnectionEventListener(null);
    conn.removeConnectionEventListener(null);
    conn.addStatementEventListener(null);
    conn.removeStatementEventListener(null);

    conn.close();
  }