public class JdbcUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
closeSilently(Connection conn)
Close a connection without throwing an exception.
|
static void |
closeSilently(ResultSet rs)
Close a result set without throwing an exception.
|
static void |
closeSilently(Statement stat)
Close a statement without throwing an exception.
|
static String |
escapeMetaDataPattern(String pattern)
Escape table or schema patterns used for DatabaseMetaData functions.
|
static Connection |
getConnection(String driver,
String url,
Properties prop)
Open a new database connection with the given settings.
|
static Connection |
getConnection(String driver,
String url,
String user,
String password)
Open a new database connection with the given settings.
|
static String |
getDriver(String url)
Get the driver class name for the given URL, or null if the URL is
unknown.
|
static void |
load(String url)
Load the driver class for the given URL, if the database URL is known.
|
public static void closeSilently(Statement stat)
stat - the statement or nullpublic static void closeSilently(Connection conn)
conn - the connection or nullpublic static void closeSilently(ResultSet rs)
rs - the result set or nullpublic static Connection getConnection(String driver, String url, String user, String password) throws SQLException
driver - the driver class nameurl - the database URLuser - the user namepassword - the passwordSQLExceptionpublic static String escapeMetaDataPattern(String pattern)
pattern - the patternpublic static Connection getConnection(String driver, String url, Properties prop) throws SQLException
driver - the driver class nameurl - the database URLprop - the properties containing at least the user name and passwordSQLExceptionpublic static String getDriver(String url)
url - the database URLpublic static void load(String url)
url - the database URLCopyright © 2012 JBoss by Red Hat. All Rights Reserved.