java.sql.SQLClientInfoException Java Examples

The following examples show how to use java.sql.SQLClientInfoException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: FoxTelem   Author: ac2cz   File: ConnectionWrapper.java    License: GNU General Public License v3.0 6 votes vote down vote up
@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;
        }
    }
}
 
Example #2
Source Project: snowflake-jdbc   Author: snowflakedb   File: LogicalConnection.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void setClientInfo(String name, String value)
throws SQLClientInfoException
{
  try
  {
    physicalConnection.setClientInfo(name, value);
  }
  catch (SQLException e)
  {
    pooledConnection.fireConnectionErrorEvent(e);
    throw e;
  }
}
 
Example #3
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: SQLClientInfoExceptionTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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));
}
 
Example #4
Source Project: presto   Author: prestosql   File: Validator.java    License: Apache License 2.0 5 votes vote down vote up
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
    }
}
 
Example #5
Source Project: lams   Author: lamsfoundation   File: ClientInfoProviderSP.java    License: GNU General Public License v2.0 5 votes vote down vote up
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;
    }
}
 
Example #6
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: SQLClientInfoExceptionTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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));
}
 
Example #7
Source Project: FHIR   Author: IBM   File: PooledConnection.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void setClientInfo(Properties properties)
                throws SQLClientInfoException {
    try {
        wrapped.setClientInfo(properties);
    }
    catch (SQLException x) {
        this.reusable = !pool.checkConnectionFailure(x);
        throw x;
    }
}
 
Example #8
Source Project: hottub   Author: dsrg-uoft   File: SQLClientInfoExceptionTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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));
}
 
Example #9
Source Project: dragonwell8_jdk   Author: alibaba   File: SQLClientInfoExceptionTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #10
Source Project: dragonwell8_jdk   Author: alibaba   File: SQLClientInfoExceptionTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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));
}
 
Example #11
Source Project: gemfirexd-oss   Author: gemxd   File: ThriftExceptionUtil.java    License: Apache License 2.0 5 votes vote down vote up
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);
}
 
Example #12
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: SQLClientInfoExceptionTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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));
}
 
Example #13
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: SQLClientInfoExceptionTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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));
}
 
Example #14
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: SQLClientInfoExceptionTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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));
}
 
Example #15
Source Project: jdk8u-jdk   Author: lambdalab-mirror   File: SQLClientInfoExceptionTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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));
}
 
Example #16
Source Project: jdk8u_jdk   Author: JetBrains   File: SQLClientInfoExceptionTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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));
}
 
Example #17
Source Project: snowflake-jdbc   Author: snowflakedb   File: ConnectionAlreadyClosedIT.java    License: Apache License 2.0 5 votes vote down vote up
private void expectSQLClientInfoException(MethodRaisesSQLClientInfoException f)
{
  try
  {
    f.run();
    fail("must raise exception");
  }
  catch (SQLClientInfoException ex)
  {
    // noup
  }
}
 
Example #18
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: SQLClientInfoExceptionTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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));
}
 
Example #19
Source Project: FoxTelem   Author: ac2cz   File: ConnectionImpl.java    License: GNU General Public License v3.0 5 votes vote down vote up
@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;
    }
}
 
Example #20
Source Project: jdk8u_jdk   Author: JetBrains   File: SQLClientInfoExceptionTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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));
}
 
Example #21
Source Project: jdk8u60   Author: chenghanpeng   File: SQLClientInfoExceptionTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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));
}
 
Example #22
Source Project: jdk8u60   Author: chenghanpeng   File: SQLClientInfoExceptionTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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));
}
 
Example #23
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: SQLClientInfoExceptionTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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));
}
 
Example #24
Source Project: cactoos-jdbc   Author: fabriciofx   File: ConnectionEnvelope.java    License: MIT License 5 votes vote down vote up
@Override
public void setClientInfo(
    final String name,
    final String value
) throws SQLClientInfoException {
    this.origin.setClientInfo(name, value);
}
 
Example #25
Source Project: beam   Author: apache   File: CalciteConnectionWrapper.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void setClientInfo(Properties properties) throws SQLClientInfoException {
  connection.setClientInfo(properties);
}
 
Example #26
Source Project: tomcatsrc   Author: wangyingjie   File: Connection.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void setClientInfo(String name, String value) throws SQLClientInfoException {
}
 
Example #27
Source Project: activemq-artemis   Author: apache   File: PostgresLargeObjectManagerTest.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void setClientInfo(Properties properties) throws SQLClientInfoException {
   throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
 
Example #28
Source Project: sakai   Author: sakaiproject   File: WrappingConnection.java    License: Educational Community License v2.0 4 votes vote down vote up
@Override
public void setClientInfo(Properties properties)
		throws SQLClientInfoException {
	c.setClientInfo(properties);
}
 
Example #29
Source Project: honeycomb   Author: ainilili   File: HoneycombConnectionDecorator.java    License: MIT License 4 votes vote down vote up
@Override
public void setClientInfo(Properties properties) throws SQLClientInfoException {
    connection.setClientInfo(properties);        
}
 
Example #30
Source Project: Komondor   Author: wn-upf   File: JDBC4FabricMySQLConnectionProxy.java    License: GNU General Public License v3.0 4 votes vote down vote up
public void setClientInfo(String name, String value) throws SQLClientInfoException {
    for (Connection c : serverConnections.values())
        c.setClientInfo(name, value);
}