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


Java ConnectionEvent.getSQLException方法代碼示例

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


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

示例1: assertDeserialized

import javax.sql.ConnectionEvent; //導入方法依賴的package包/類
public void assertDeserialized(Serializable initial,
        Serializable deserialized) {
    ConnectionEvent ceInitial = (ConnectionEvent) initial;
    ConnectionEvent ceDeser = (ConnectionEvent) deserialized;

    SQLException initThr = ceInitial.getSQLException();
    SQLException dserThr = ceDeser.getSQLException();

    // verify SQLState
    assertEquals(initThr.getSQLState(), dserThr.getSQLState());

    // verify vendorCode
    assertEquals(initThr.getErrorCode(), dserThr.getErrorCode());

    // verify next
    if (initThr.getNextException() == null) {
        assertNull(dserThr.getNextException());
    }
}
 
開發者ID:keplersj,項目名稱:In-the-Box-Fork,代碼行數:20,代碼來源:ConnectionEventTest.java

示例2: connectionErrorOccurred

import javax.sql.ConnectionEvent; //導入方法依賴的package包/類
/**
 * If a fatal error occurs, close the underlying physical connection so as
 * not to be returned in the future
 */
public void connectionErrorOccurred(ConnectionEvent event) {
    PooledConnection pc = (PooledConnection)event.getSource();
    if (null != event.getSQLException()) {
        System.err
            .println("CLOSING DOWN CONNECTION DUE TO INTERNAL ERROR (" +
                     event.getSQLException() + ")");
    }
    pc.removeConnectionEventListener(this);

    PooledConnectionAndInfo info = (PooledConnectionAndInfo) pcMap.get(pc);
    if (info == null) {
        throw new IllegalStateException(NO_KEY_MESSAGE);
    }
    try {
        _pool.invalidateObject(info.getUserPassKey(), info);
    } catch (Exception e) {
        System.err.println("EXCEPTION WHILE DESTROYING OBJECT " + info);
        e.printStackTrace();
    }
}
 
開發者ID:WhiteBearSolutions,項目名稱:WBSAirback,代碼行數:25,代碼來源:KeyedCPDSConnectionFactory.java

示例3: connectionErrorOccurred

import javax.sql.ConnectionEvent; //導入方法依賴的package包/類
/**
 * If a fatal error occurs, close the underlying physical connection so as
 * not to be returned in the future
 */
public void connectionErrorOccurred(ConnectionEvent event) {
    PooledConnection pc = (PooledConnection)event.getSource();
    if (null != event.getSQLException()) {
        System.err.println(
                "CLOSING DOWN CONNECTION DUE TO INTERNAL ERROR ("
                + event.getSQLException() + ")");
    }
    pc.removeConnectionEventListener(this);

    Object info = pcMap.get(pc);
    if (info == null) {
        throw new IllegalStateException(NO_KEY_MESSAGE);
    }
    try {
        _pool.invalidateObject(info);
    } catch (Exception e) {
        System.err.println("EXCEPTION WHILE DESTROYING OBJECT " + info);
        e.printStackTrace();
    }
}
 
開發者ID:WhiteBearSolutions,項目名稱:WBSAirback,代碼行數:25,代碼來源:CPDSConnectionFactory.java

示例4: connectionErrorOccurred

import javax.sql.ConnectionEvent; //導入方法依賴的package包/類
/**
 * If a fatal error occurs, close the underlying physical connection so as
 * not to be returned in the future
 */
@Override
public void connectionErrorOccurred(final ConnectionEvent event) {
    final PooledConnection pc = (PooledConnection)event.getSource();
    if (null != event.getSQLException()) {
        System.err
            .println("CLOSING DOWN CONNECTION DUE TO INTERNAL ERROR (" +
                     event.getSQLException() + ")");
    }
    pc.removeConnectionEventListener(this);

    final PooledConnectionAndInfo info = pcMap.get(pc);
    if (info == null) {
        throw new IllegalStateException(NO_KEY_MESSAGE);
    }
    try {
        _pool.invalidateObject(info.getUserPassKey(), info);
    } catch (final Exception e) {
        System.err.println("EXCEPTION WHILE DESTROYING OBJECT " + info);
        e.printStackTrace();
    }
}
 
開發者ID:apache,項目名稱:commons-dbcp,代碼行數:26,代碼來源:KeyedCPDSConnectionFactory.java

示例5: connectionErrorOccurred

import javax.sql.ConnectionEvent; //導入方法依賴的package包/類
/**
 * If a fatal error occurs, close the underlying physical connection so as
 * not to be returned in the future
 */
@Override
public void connectionErrorOccurred(final ConnectionEvent event) {
    final PooledConnection pc = (PooledConnection)event.getSource();
    if (null != event.getSQLException()) {
        System.err.println(
                "CLOSING DOWN CONNECTION DUE TO INTERNAL ERROR ("
                + event.getSQLException() + ")");
    }
    pc.removeConnectionEventListener(this);

    final PooledConnectionAndInfo pci = pcMap.get(pc);
    if (pci == null) {
        throw new IllegalStateException(NO_KEY_MESSAGE);
    }
    try {
        _pool.invalidateObject(pci);
    } catch (final Exception e) {
        System.err.println("EXCEPTION WHILE DESTROYING OBJECT " + pci);
        e.printStackTrace();
    }
}
 
開發者ID:apache,項目名稱:commons-dbcp,代碼行數:26,代碼來源:CPDSConnectionFactory.java

示例6: connectionClosed

import javax.sql.ConnectionEvent; //導入方法依賴的package包/類
public void connectionClosed(ConnectionEvent event) {
    sqlException = event.getSQLException();
    closed = true;
}
 
開發者ID:MariaDB,項目名稱:mariadb-connector-j,代碼行數:5,代碼來源:MyEventListener.java

示例7: connectionErrorOccurred

import javax.sql.ConnectionEvent; //導入方法依賴的package包/類
public void connectionErrorOccurred(ConnectionEvent event) {
    sqlException = event.getSQLException();
    connectionErrorOccured = true;
}
 
開發者ID:MariaDB,項目名稱:mariadb-connector-j,代碼行數:5,代碼來源:MyEventListener.java


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