當前位置: 首頁>>代碼示例>>Java>>正文


Java Connection.clearWarnings方法代碼示例

本文整理匯總了Java中java.sql.Connection.clearWarnings方法的典型用法代碼示例。如果您正苦於以下問題:Java Connection.clearWarnings方法的具體用法?Java Connection.clearWarnings怎麽用?Java Connection.clearWarnings使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.sql.Connection的用法示例。


在下文中一共展示了Connection.clearWarnings方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getConnection

import java.sql.Connection; //導入方法依賴的package包/類
/**
 * @return a Connection instance that can be used to connect to the
 * given database, if a previously-opened connection is available in
 * the cache. Returns null if none is available in the map.
 */
public synchronized Connection getConnection(String connectStr,
    String username) throws SQLException {
  CacheKey key = new CacheKey(connectStr, username);
  Connection cached = connectionMap.get(key);
  if (null != cached) {
    connectionMap.remove(key);
    if (cached.isReadOnly()) {
      // Read-only mode? Don't want it.
      cached.close();
    }

    if (cached.isClosed()) {
      // This connection isn't usable.
      return null;
    }

    cached.rollback(); // Reset any transaction state.
    cached.clearWarnings();

    LOG.debug("Got cached connection for " + key);
  }

  return cached;
}
 
開發者ID:BriData,項目名稱:DBus,代碼行數:30,代碼來源:OracleManager.java

示例2: initializes_lazy

import java.sql.Connection; //導入方法依賴的package包/類
@Test
public void initializes_lazy() throws SQLException {
    final Connection proxy = subject.getConnection();
    assertNotNull(proxy);
    verify(factory, never()).get();
    proxy.clearWarnings();
    proxy.clearWarnings();
    verify(factory).get();
}
 
開發者ID:dajudge,項目名稱:testee.fi,代碼行數:10,代碼來源:TesteeDataSourceTest.java


注:本文中的java.sql.Connection.clearWarnings方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。