public class DbBase
extends java.lang.Object
History:
Constructor and Description |
---|
DbBase() |
Modifier and Type | Method and Description |
---|---|
static void |
CloseConnection(java.sql.Connection conn)
Close a specified connection (session) with a database
|
static void |
CloseConnection(java.sql.Connection conn,
Configuration config)
Close a specified connection (session) with a database
|
static java.lang.String |
FormatSqlStr(java.lang.String inStr)
Format a String to SQL standard format
|
static java.sql.Connection |
OpenConnection(Configuration config)
Open a connection using URL specified in configuration bundle
|
static java.sql.Connection |
OpenConnection(Configuration config,
java.lang.String dbVersion)
Open a connection using URL specified in configuration bundle
|
static java.sql.Connection |
OpenConnection(java.lang.String driverName,
java.lang.String url,
java.lang.String userName,
java.lang.String password)
Open a connection to a specified URL of the database and specifying
a JDBC driver
|
(package private) static void |
SubmitDML(java.lang.String query,
Configuration config)
Submit a query to a specific database.
|
static java.lang.String |
ToSqlStr(java.lang.String in)
Convert a String to SQL standard format on escape characters
|
public static java.sql.Connection OpenConnection(Configuration config) throws java.sql.SQLException
config
- configuration bundlejava.sql.SQLException
- if there is a SQL error happenspublic static java.sql.Connection OpenConnection(Configuration config, java.lang.String dbVersion)
config
- configuration bundledbVersion
- db Version to override the param in configjava.sql.SQLException
- if there is a SQL error happenspublic static java.sql.Connection OpenConnection(java.lang.String driverName, java.lang.String url, java.lang.String userName, java.lang.String password) throws java.sql.SQLException
driverName
- JDBC connection driverurl
- JDBC connection URLuserName
- user name for the DBpassword
- password for the DBjava.sql.SQLException
- if there is a SQL error happenspublic static void CloseConnection(java.sql.Connection conn) throws java.sql.SQLException
conn
- database connectionjava.sql.SQLException
- if there is a SQL error happenspublic static void CloseConnection(java.sql.Connection conn, Configuration config) throws java.sql.SQLException
conn
- database connectionconfig
- configuration bundlejava.sql.SQLException
- if there is a SQL error happenspublic static java.lang.String FormatSqlStr(java.lang.String inStr)
inStr
- input SQL query stringpublic static java.lang.String ToSqlStr(java.lang.String in)
in
- input SQL stringstatic void SubmitDML(java.lang.String query, Configuration config)
query
- a SQL query to be submittedconfig
- a configuration object Submit a bug or feature
Copyright © 2013 National Library of Medicine