下面列出了java.sql.SQLClientInfoException#initCause ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
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;
}
}
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;
}
}
}
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;
}
}
}
@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;
}
}
}
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;
}
}
}
@Override
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;
}
}
}
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;
}
}
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;
}
}
}
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;
}
}
}
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;
}
}
@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;
}
}
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;
}
}
@Override
public void setClientInfo(String name, String value) throws SQLClientInfoException {
try {
getClientInfoProviderImpl().setClientInfo(this, name, value);
} catch (SQLClientInfoException ciEx) {
throw ciEx;
} catch (SQLException | CJException sqlEx) {
SQLClientInfoException clientInfoEx = new SQLClientInfoException();
clientInfoEx.initCause(sqlEx);
throw clientInfoEx;
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
/**
* Sets the value of the connection's client info properties. The
* <code>Properties</code> object contains the names and values of the client info
* properties to be set. The set of client info properties contained in
* the properties list replaces the current set of client info properties
* on the connection. If a property that is currently set on the
* connection is not present in the properties list, that property is
* cleared. Specifying an empty properties list will clear all of the
* properties on the connection. See <code>setClientInfo (String, String)</code> for
* more information.
* <p>
* If an error occurs in setting any of the client info properties, a
* <code>SQLClientInfoException</code> is thrown. The <code>SQLClientInfoException</code>
* contains information indicating which client info properties were not set.
* The state of the client information is unknown because
* some databases do not allow multiple client info properties to be set
* atomically. For those databases, one or more properties may have been
* set before the error occurred.
* <p>
*
* @param properties the list of client info properties to set
* <p>
* @see java.sql.Connection#setClientInfo(String, String) setClientInfo(String, String)
* @since JDK 1.6, HSQLDB 2.0
* <p>
* @throws SQLClientInfoException if the database server returns an error while
* setting the clientInfo values on the database server or this method
* is called on a closed connection
* <p>
*/
//#ifdef JAVA6
public void setClientInfo(
Properties properties) throws SQLClientInfoException {
if (!this.isClosed && (properties == null || properties.isEmpty())) {
return;
}
SQLClientInfoException ex = new SQLClientInfoException();
if (this.isClosed) {
ex.initCause(JDBCUtil.connectionClosedException());
} else {
ex.initCause(JDBCUtil.notSupported());
}
throw ex;
}
/**
* Sets the value of the client info property specified by name to the
* value specified by value.
* <p>
* Applications may use the <code>DatabaseMetaData.getClientInfoProperties</code>
* method to determine the client info properties supported by the driver
* and the maximum length that may be specified for each property.
* <p>
* The driver stores the value specified in a suitable location in the
* database. For example in a special register, session parameter, or
* system table column. For efficiency the driver may defer setting the
* value in the database until the next time a statement is executed or
* prepared. Other than storing the client information in the appropriate
* place in the database, these methods shall not alter the behavior of
* the connection in anyway. The values supplied to these methods are
* used for accounting, diagnostics and debugging purposes only.
* <p>
* The driver shall generate a warning if the client info name specified
* is not recognized by the driver.
* <p>
* If the value specified to this method is greater than the maximum
* length for the property the driver may either truncate the value and
* generate a warning or generate a <code>SQLClientInfoException</code>. If the driver
* generates a <code>SQLClientInfoException</code>, the value specified was not set on the
* connection.
* <p>
* The following are standard client info properties. Drivers are not
* required to support these properties however if the driver supports a
* client info property that can be described by one of the standard
* properties, the standard property name should be used.
* <p>
* <ul>
* <li>ApplicationName - The name of the application currently utilizing
* the connection</li>
* <li>ClientUser - The name of the user that the application using
* the connection is performing work for. This may
* not be the same as the user name that was used
* in establishing the connection.</li>
* <li>ClientHostname - The host name of the computer the application
* using the connection is running on.</li>
* </ul>
* <p>
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* HSQLDB 2.0, throws an SQLClientInfoException when this method is
* called.
* </div>
* <!-- end release-specific documentation -->
*
* @param name The name of the client info property to set
* @param value The value to set the client info property to. If the
* value is null, the current value of the specified
* property is cleared.
* <p>
* @throws SQLClientInfoException if the database server returns an error while
* setting the client info value on the database server or this method
* is called on a closed connection
* <p>
* @since JDK 1.6, HSQLDB 2.0
*/
//#ifdef JAVA6
public void setClientInfo(String name,
String value) throws SQLClientInfoException {
SQLClientInfoException ex = new SQLClientInfoException();
ex.initCause(JDBCUtil.notSupported());
throw ex;
}