类java.sql.SQLClientInfoException源码实例Demo

下面列出了怎么用java.sql.SQLClientInfoException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: FoxTelem   文件: ConnectionWrapper.java
@Override
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 项目: snowflake-jdbc   文件: LogicalConnection.java
@Override
public void setClientInfo(String name, String value)
throws SQLClientInfoException
{
  try
  {
    physicalConnection.setClientInfo(name, value);
  }
  catch (SQLException e)
  {
    pooledConnection.fireConnectionErrorEvent(e);
    throw e;
  }
}
 
/**
 * Create SQLClientInfoException with null Throwable
 */
@Test
public void test2() {

    SQLClientInfoException ex = new SQLClientInfoException(map, null);
    assertTrue(ex.getMessage() == null
            && ex.getSQLState() == null
            && ex.getCause() == null
            && ex.getErrorCode() == 0
            && ex.getFailedProperties().equals(map));
}
 
源代码4 项目: presto   文件: Validator.java
private void trySetConnectionProperties(Query query, Connection connection)
        throws SQLException
{
    // Required for jdbc drivers that do not implement all/some of these functions (eg. impala jdbc driver)
    // For these drivers, set the database default values in the query database
    try {
        connection.setClientInfo("ApplicationName", "verifier-test:" + queryPair.getName());
        connection.setCatalog(query.getCatalog());
        connection.setSchema(query.getSchema());
    }
    catch (SQLClientInfoException ignored) {
        // Do nothing
    }
}
 
源代码5 项目: lams   文件: ClientInfoProviderSP.java
public synchronized void setClientInfo(java.sql.Connection conn, String name, String value) throws SQLClientInfoException {
    try {
        this.setClientInfoSp.setString(1, name);
        this.setClientInfoSp.setString(2, value);
        this.setClientInfoSp.execute();
    } catch (SQLException sqlEx) {
        SQLClientInfoException clientInfoEx = new SQLClientInfoException();
        clientInfoEx.initCause(sqlEx);

        throw clientInfoEx;
    }
}
 
/**
 * 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));
}
 
源代码7 项目: FHIR   文件: PooledConnection.java
@Override
public void setClientInfo(Properties properties)
                throws SQLClientInfoException {
    try {
        wrapped.setClientInfo(properties);
    }
    catch (SQLException x) {
        this.reusable = !pool.checkConnectionFailure(x);
        throw x;
    }
}
 
源代码8 项目: hottub   文件: SQLClientInfoExceptionTests.java
/**
 * 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));
}
 
/**
 * Create SQLClientInfoException with no-arg constructor
 */
@Test
public void test1() {
    SQLClientInfoException ex = new SQLClientInfoException();
    assertTrue(ex.getMessage() == null
            && ex.getSQLState() == null
            && ex.getCause() == null
            && ex.getErrorCode() == 0
            && ex.getFailedProperties() == null);
}
 
/**
 * 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));
}
 
源代码11 项目: gemfirexd-oss   文件: ThriftExceptionUtil.java
public static SQLClientInfoException newSQLClientInfoException(
    String sqlState, Map<String, ClientInfoStatus> failedProperties,
    Throwable t, Object... args) {
  return new SQLClientInfoException(getMessageUtil().getCompleteMessage(
      sqlState, args), getSQLStateFromIdentifier(sqlState),
      getSeverityFromIdentifier(sqlState), failedProperties, t);
}
 
/**
 * 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));
}
 
源代码13 项目: openjdk-jdk9   文件: SQLClientInfoExceptionTests.java
/**
 * 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));
}
 
/**
 * Create SQLClientInfoException with message, and SQLState
 */
@Test
public void test6() {
    SQLClientInfoException ex = new SQLClientInfoException(reason, state,
            map, t);
    assertTrue(ex.getMessage().equals(reason)
            && ex.getSQLState().equals(state)
            && cause.equals(ex.getCause().toString())
            && ex.getErrorCode() == 0
            && ex.getFailedProperties().equals(map));
}
 
源代码15 项目: jdk8u-jdk   文件: SQLClientInfoExceptionTests.java
/**
 * Create SQLClientInfoException with null Throwable
 */
@Test
public void test2() {

    SQLClientInfoException ex = new SQLClientInfoException(map, null);
    assertTrue(ex.getMessage() == null
            && ex.getSQLState() == null
            && ex.getCause() == null
            && ex.getErrorCode() == 0
            && ex.getFailedProperties().equals(map));
}
 
源代码16 项目: jdk8u_jdk   文件: SQLClientInfoExceptionTests.java
/**
 * 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));
}
 
源代码17 项目: snowflake-jdbc   文件: ConnectionAlreadyClosedIT.java
private void expectSQLClientInfoException(MethodRaisesSQLClientInfoException f)
{
  try
  {
    f.run();
    fail("must raise exception");
  }
  catch (SQLClientInfoException ex)
  {
    // noup
  }
}
 
/**
 * 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));
}
 
源代码19 项目: FoxTelem   文件: ConnectionImpl.java
@Override
public void setClientInfo(Properties properties) throws SQLClientInfoException {
    try {
        getClientInfoProviderImpl().setClientInfo(this, properties);
    } catch (SQLClientInfoException ciEx) {
        throw ciEx;
    } catch (SQLException | CJException sqlEx) {
        SQLClientInfoException clientInfoEx = new SQLClientInfoException();
        clientInfoEx.initCause(sqlEx);

        throw clientInfoEx;
    }
}
 
源代码20 项目: jdk8u_jdk   文件: SQLClientInfoExceptionTests.java
/**
 * Create SQLClientInfoException with null Throwable
 */
@Test
public void test2() {

    SQLClientInfoException ex = new SQLClientInfoException(map, null);
    assertTrue(ex.getMessage() == null
            && ex.getSQLState() == null
            && ex.getCause() == null
            && ex.getErrorCode() == 0
            && ex.getFailedProperties().equals(map));
}
 
源代码21 项目: jdk8u60   文件: SQLClientInfoExceptionTests.java
/**
 * Create SQLClientInfoException with null Throwable
 */
@Test
public void test2() {

    SQLClientInfoException ex = new SQLClientInfoException(map, null);
    assertTrue(ex.getMessage() == null
            && ex.getSQLState() == null
            && ex.getCause() == null
            && ex.getErrorCode() == 0
            && ex.getFailedProperties().equals(map));
}
 
源代码22 项目: jdk8u60   文件: SQLClientInfoExceptionTests.java
/**
 * 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));
}
 
/**
 * 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));
}
 
源代码24 项目: cactoos-jdbc   文件: ConnectionEnvelope.java
@Override
public void setClientInfo(
    final String name,
    final String value
) throws SQLClientInfoException {
    this.origin.setClientInfo(name, value);
}
 
源代码25 项目: beam   文件: CalciteConnectionWrapper.java
@Override
public void setClientInfo(Properties properties) throws SQLClientInfoException {
  connection.setClientInfo(properties);
}
 
源代码26 项目: tomcatsrc   文件: Connection.java
@Override
public void setClientInfo(String name, String value) throws SQLClientInfoException {
}
 
@Override
public void setClientInfo(Properties properties) throws SQLClientInfoException {
   throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
 
源代码28 项目: sakai   文件: WrappingConnection.java
@Override
public void setClientInfo(Properties properties)
		throws SQLClientInfoException {
	c.setClientInfo(properties);
}
 
源代码29 项目: honeycomb   文件: HoneycombConnectionDecorator.java
@Override
public void setClientInfo(Properties properties) throws SQLClientInfoException {
    connection.setClientInfo(properties);        
}
 
源代码30 项目: Komondor   文件: JDBC4FabricMySQLConnectionProxy.java
public void setClientInfo(String name, String value) throws SQLClientInfoException {
    for (Connection c : serverConnections.values())
        c.setClientInfo(name, value);
}