本文整理汇总了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;
}
}