本文整理匯總了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());
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例6: connectionClosed
import javax.sql.ConnectionEvent; //導入方法依賴的package包/類
public void connectionClosed(ConnectionEvent event) {
sqlException = event.getSQLException();
closed = true;
}
示例7: connectionErrorOccurred
import javax.sql.ConnectionEvent; //導入方法依賴的package包/類
public void connectionErrorOccurred(ConnectionEvent event) {
sqlException = event.getSQLException();
connectionErrorOccured = true;
}