Package org.apache.commons.dbcp2
Class Utils
- java.lang.Object
-
- org.apache.commons.dbcp2.Utils
-
public final class Utils extends java.lang.Object
Utility methods.- Since:
- 2.0
- Version:
- $Id: Utils.java 1680126 2015-05-18 23:22:01Z ggregory $
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DISCONNECTION_SQL_CODE_PREFIX
Any SQL_STATE starting with this value is considered a fatal disconnectstatic java.util.Set<java.lang.String>
DISCONNECTION_SQL_CODES
SQL codes of fatal connection errors.static boolean
IS_SECURITY_ENABLED
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
closeQuietly(java.sql.Connection conn)
Closes the Connection (which may be null).static void
closeQuietly(java.sql.ResultSet rset)
Closes the ResultSet (which may be null).static void
closeQuietly(java.sql.Statement stmt)
Closes the Statement (which may be null).static java.lang.String
getMessage(java.lang.String key)
Obtain the correct i18n message for the given key.static java.lang.String
getMessage(java.lang.String key, java.lang.Object... args)
Obtain the correct i18n message for the given key with placeholders replaced by the supplied arguments.
-
-
-
Field Detail
-
IS_SECURITY_ENABLED
public static final boolean IS_SECURITY_ENABLED
-
DISCONNECTION_SQL_CODE_PREFIX
public static final java.lang.String DISCONNECTION_SQL_CODE_PREFIX
Any SQL_STATE starting with this value is considered a fatal disconnect- See Also:
- Constant Field Values
-
DISCONNECTION_SQL_CODES
public static final java.util.Set<java.lang.String> DISCONNECTION_SQL_CODES
SQL codes of fatal connection errors.- 57P01 (ADMIN SHUTDOWN)
- 57P02 (CRASH SHUTDOWN)
- 57P03 (CANNOT CONNECT NOW)
- 01002 (SQL92 disconnect error)
- JZ0C0 (Sybase disconnect error)
- JZ0C1 (Sybase disconnect error)
-
-
Method Detail
-
closeQuietly
public static void closeQuietly(java.sql.ResultSet rset)
Closes the ResultSet (which may be null).- Parameters:
rset
- a ResultSet, may benull
-
closeQuietly
public static void closeQuietly(java.sql.Connection conn)
Closes the Connection (which may be null).- Parameters:
conn
- a Connection, may benull
-
closeQuietly
public static void closeQuietly(java.sql.Statement stmt)
Closes the Statement (which may be null).- Parameters:
stmt
- a Statement, may benull
-
getMessage
public static java.lang.String getMessage(java.lang.String key)
Obtain the correct i18n message for the given key.
-
getMessage
public static java.lang.String getMessage(java.lang.String key, java.lang.Object... args)
Obtain the correct i18n message for the given key with placeholders replaced by the supplied arguments.
-
-