Search in sources :

Example 6 with SQLClientInfoException

use of java.sql.SQLClientInfoException in project jdk8u_jdk by JetBrains.

the class SQLClientInfoExceptionTests method test1.

/**
     * 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);
}
Also used : SQLClientInfoException(java.sql.SQLClientInfoException) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 7 with SQLClientInfoException

use of java.sql.SQLClientInfoException in project jdk8u_jdk by JetBrains.

the class SQLClientInfoExceptionTests method test5.

/**
     * 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));
}
Also used : SQLClientInfoException(java.sql.SQLClientInfoException) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 8 with SQLClientInfoException

use of java.sql.SQLClientInfoException in project tomcat by apache.

the class DelegatingConnection method setClientInfo.

@Override
public void setClientInfo(final String name, final String value) throws SQLClientInfoException {
    try {
        checkOpen();
        _conn.setClientInfo(name, value);
    } catch (final SQLClientInfoException e) {
        throw e;
    } catch (final SQLException e) {
        throw new SQLClientInfoException("Connection is closed.", EMPTY_FAILED_PROPERTIES, e);
    }
}
Also used : SQLClientInfoException(java.sql.SQLClientInfoException) SQLException(java.sql.SQLException)

Example 9 with SQLClientInfoException

use of java.sql.SQLClientInfoException in project jdbc-shards by wplatform.

the class JdbcConnection method getClientInfo.

/**
     * Get a client property.
     *
     * @param name the client info name (ignored)
     * @return the property value
     */
@Override
public String getClientInfo(String name) throws SQLException {
    try {
        if (isDebugEnabled()) {
            debugCodeCall("getClientInfo", name);
        }
        checkClosed();
        Properties p = getClientInfo();
        String s = p.getProperty(name);
        if (s == null) {
            throw new SQLClientInfoException();
        }
        return s;
    } catch (Exception e) {
        throw logAndConvert(e);
    }
}
Also used : SQLClientInfoException(java.sql.SQLClientInfoException) ValueString(com.wplatform.ddal.value.ValueString) SysProperties(com.wplatform.ddal.engine.SysProperties) Properties(java.util.Properties) SQLClientInfoException(java.sql.SQLClientInfoException) SQLException(java.sql.SQLException) DbException(com.wplatform.ddal.message.DbException)

Example 10 with SQLClientInfoException

use of java.sql.SQLClientInfoException in project jdk8u_jdk by JetBrains.

the class SQLClientInfoExceptionTests method test2.

/**
     * 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));
}
Also used : SQLClientInfoException(java.sql.SQLClientInfoException) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Aggregations

SQLClientInfoException (java.sql.SQLClientInfoException)17 Test (org.testng.annotations.Test)12 BaseTest (util.BaseTest)12 SQLException (java.sql.SQLException)5 SysProperties (com.wplatform.ddal.engine.SysProperties)1 DbException (com.wplatform.ddal.message.DbException)1 ValueString (com.wplatform.ddal.value.ValueString)1 Blob (java.sql.Blob)1 Connection (java.sql.Connection)1 PreparedStatement (java.sql.PreparedStatement)1 ResultSet (java.sql.ResultSet)1 SQLFeatureNotSupportedException (java.sql.SQLFeatureNotSupportedException)1 SQLWarning (java.sql.SQLWarning)1 Savepoint (java.sql.Savepoint)1 Statement (java.sql.Statement)1 Properties (java.util.Properties)1