public class DbUtil extends Object
DatabaseTypeFactory for additional database functionality.DatabaseTypeFactory| Modifier and Type | Method and Description |
|---|---|
static Connection |
getConnection(String jdbc_url,
String username,
String password)
Given a JDBC URL, this will attempt to create a connection to the database.
|
static String |
getSQLExceptionString(SQLException e)
Given an SQL exception, this will return a string that contains the error code and message for it and its causes.
|
static boolean |
ping(String jdbc_url,
String username,
String password)
Pings a database by simply connecting to it.
|
public static Connection getConnection(String jdbc_url, String username, String password) throws SQLException
DatabaseType object via DatabaseTypeFactory.getDatabaseType(Connection).jdbc_url - a connection URL to the databaseusername - may be null in which case an anonymous login will be attemptedpassword - SQLException - if failed to connect to the databasepublic static boolean ping(String jdbc_url, String username, String password)
true. If the connection attempt fails, this returns false.jdbc_url - username - password - true if a connection to the database can be madepublic static String getSQLExceptionString(SQLException e)
e - the SQL exceptionCopyright © 2008-2014 Red Hat, Inc.. All Rights Reserved.