本文整理匯總了Java中java.sql.SQLClientInfoException類的典型用法代碼示例。如果您正苦於以下問題:Java SQLClientInfoException類的具體用法?Java SQLClientInfoException怎麽用?Java SQLClientInfoException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
SQLClientInfoException類屬於java.sql包,在下文中一共展示了SQLClientInfoException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setClientInfo
import java.sql.SQLClientInfoException; //導入依賴的package包/類
public void setClientInfo(String name, String value) throws SQLClientInfoException {
try {
checkClosed();
((java.sql.Connection) this.mc).setClientInfo(name, value);
} catch (SQLException sqlException) {
try {
checkAndFireConnectionError(sqlException);
} catch (SQLException sqlEx2) {
SQLClientInfoException clientEx = new SQLClientInfoException();
clientEx.initCause(sqlEx2);
throw clientEx;
}
}
}
示例2: setClientInfo
import java.sql.SQLClientInfoException; //導入依賴的package包/類
public void setClientInfo(Properties properties) throws SQLClientInfoException {
try {
checkClosed();
((java.sql.Connection) this.mc).setClientInfo(properties);
} catch (SQLException sqlException) {
try {
checkAndFireConnectionError(sqlException);
} catch (SQLException sqlEx2) {
SQLClientInfoException clientEx = new SQLClientInfoException();
clientEx.initCause(sqlEx2);
throw clientEx;
}
}
}
示例3: test11
import java.sql.SQLClientInfoException; //導入依賴的package包/類
/**
* Validate that the ordering of the returned Exceptions is correct using
* for-each loop
*/
@Test
public void test11() {
SQLClientInfoException ex = new SQLClientInfoException("Exception 1",
map, t1);
SQLClientInfoException ex1 = new SQLClientInfoException("Exception 2",
map);
SQLClientInfoException ex2 = new SQLClientInfoException("Exception 3",
map, t2);
ex.setNextException(ex1);
ex.setNextException(ex2);
int num = 0;
for (Throwable e : ex) {
assertTrue(msgs[num++].equals(e.getMessage()));
}
}
示例4: setClientInfo
import java.sql.SQLClientInfoException; //導入依賴的package包/類
public synchronized void setClientInfo(java.sql.Connection conn, Properties properties) throws SQLClientInfoException {
try {
Enumeration<?> propNames = properties.propertyNames();
while (propNames.hasMoreElements()) {
String name = (String) propNames.nextElement();
String value = properties.getProperty(name);
setClientInfo(conn, name, value);
}
} catch (SQLException sqlEx) {
SQLClientInfoException clientInfoEx = new SQLClientInfoException();
clientInfoEx.initCause(sqlEx);
throw clientInfoEx;
}
}
示例5: isOkaySpecialCaseException
import java.sql.SQLClientInfoException; //導入依賴的package包/類
@Override
protected boolean isOkaySpecialCaseException(Method method, Throwable cause) {
final boolean result;
if (super.isOkaySpecialCaseException(method, cause)) {
result = true;
}
else if (SQLClientInfoException.class == cause.getClass()
&& normalClosedExceptionText.equals(cause.getMessage())
&& (false
|| method.getName().equals("setClientInfo")
|| method.getName().equals("getClientInfo")
)) {
// Special good case--we had to use SQLClientInfoException from those.
result = true;
}
else if (RuntimeException.class == cause.getClass()
&& normalClosedExceptionText.equals(cause.getMessage())
&& (false
|| method.getName().equals("getCatalog")
|| method.getName().equals("getSchema")
)) {
// Special good-enough case--we had to use RuntimeException for now.
result = true;
}
else {
result = false;
}
return result;
}
示例6: setClientInfo
import java.sql.SQLClientInfoException; //導入依賴的package包/類
public void setClientInfo(
Properties properties) throws SQLClientInfoException {
try {
validate();
} catch (SQLException e) {
throw new SQLClientInfoException(e.getMessage(), e.getSQLState(),
e.getErrorCode(), (Map<String, ClientInfoStatus>) null, e);
}
this.getConnection().setClientInfo(properties);
}
示例7: test10
import java.sql.SQLClientInfoException; //導入依賴的package包/類
/**
* Serialize a SQLClientInfoException and make sure you can read it back
* properly
*/
@Test
public void test10() throws Exception {
SQLClientInfoException e = new SQLClientInfoException(reason, state,
errorCode, map, t);
SQLClientInfoException ex1 =
createSerializedException(e);
assertTrue(reason.equals(ex1.getMessage())
&& ex1.getSQLState().equals(state)
&& cause.equals(ex1.getCause().toString())
&& ex1.getErrorCode() == errorCode
&& ex1.getFailedProperties().equals(map));
}
示例8: test8
import java.sql.SQLClientInfoException; //導入依賴的package包/類
/**
* Create SQLClientInfoException with message, SQLState, and error code
*/
@Test
public void test8() {
SQLClientInfoException ex = new SQLClientInfoException(reason, state,
errorCode, map, t);
assertTrue(ex.getMessage().equals(reason)
&& ex.getSQLState().equals(state)
&& cause.equals(ex.getCause().toString())
&& ex.getErrorCode() == errorCode
&& ex.getFailedProperties().equals(map));
}
示例9: test7
import java.sql.SQLClientInfoException; //導入依賴的package包/類
/**
* Create SQLClientInfoException with message, SQLState, errorCode, and
* Throwable
*/
@Test
public void test7() {
SQLClientInfoException ex = new SQLClientInfoException(reason, state,
errorCode, map);
assertTrue(ex.getMessage().equals(reason)
&& ex.getSQLState().equals(state)
&& ex.getCause() == null
&& ex.getErrorCode() == errorCode
&& ex.getFailedProperties().equals(map));
}
示例10: test4
import java.sql.SQLClientInfoException; //導入依賴的package包/類
/**
* Create SQLClientInfoException with null Throwable
*/
@Test
public void test4() {
SQLClientInfoException ex = new SQLClientInfoException(reason, map, null);
assertTrue(ex.getMessage().equals(reason)
&& ex.getSQLState() == null
&& ex.getCause() == null
&& ex.getErrorCode() == 0
&& ex.getFailedProperties().equals(map));
}
示例11: test3
import java.sql.SQLClientInfoException; //導入依賴的package包/類
/**
* Create SQLClientInfoException with message
*/
@Test
public void test3() {
SQLClientInfoException ex = new SQLClientInfoException(reason, map);
assertTrue(ex.getMessage().equals(reason)
&& ex.getSQLState() == null
&& ex.getCause() == null
&& ex.getErrorCode() == 0
&& ex.getFailedProperties().equals(map));
}
示例12: setClientInfo
import java.sql.SQLClientInfoException; //導入依賴的package包/類
public void setClientInfo(Properties properties) throws SQLClientInfoException
{
try
{
realConnection.setClientInfo(properties);
}
catch(SQLClientInfoException s)
{
String methodCall = "setClientInfo(" + properties + ")";
reportException(methodCall, s, null);
throw s;
}
}
示例13: setClientInfo
import java.sql.SQLClientInfoException; //導入依賴的package包/類
public void setClientInfo(Properties properties) throws SQLClientInfoException {
try {
getClientInfoProviderImpl().setClientInfo(this, properties);
} catch (SQLClientInfoException ciEx) {
throw ciEx;
} catch (SQLException sqlEx) {
SQLClientInfoException clientInfoEx = new SQLClientInfoException();
clientInfoEx.initCause(sqlEx);
throw clientInfoEx;
}
}
示例14: test5
import java.sql.SQLClientInfoException; //導入依賴的package包/類
/**
* Create SQLClientInfoException with message, and SQLState
*/
@Test
public void test5() {
SQLClientInfoException ex = new SQLClientInfoException(reason, state,
map);
assertTrue(ex.getMessage().equals(reason)
&& ex.getSQLState().equals(state)
&& ex.getCause() == null
&& ex.getErrorCode() == 0
&& ex.getFailedProperties().equals(map));
}
示例15: setClientInfo
import java.sql.SQLClientInfoException; //導入依賴的package包/類
public void setClientInfo(String name, String value) throws SQLClientInfoException {
try {
getClientInfoProviderImpl().setClientInfo(this, name, value);
} catch (SQLClientInfoException ciEx) {
throw ciEx;
} catch (SQLException sqlEx) {
SQLClientInfoException clientInfoEx = new SQLClientInfoException();
clientInfoEx.initCause(sqlEx);
throw clientInfoEx;
}
}