LexAccess Java
2006 Version

gov.nih.nlm.nls.lexAccess.Db
Class DbBase

java.lang.Object
  extended by gov.nih.nlm.nls.lexAccess.Db.DbBase

public class DbBase
extends java.lang.Object

This class provides base interfaces to LexAccess database. This class utilizes Java DataBase Connectivity (JDBC) to connection to database (Instant DB or other DBs).

History:

Version:
V-2006
Author:
NLM NLS Development Team

Constructor Summary
DbBase()
           
 
Method Summary
static void CloseConnection(java.sql.Connection conn)
          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(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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DbBase

public DbBase()
Method Detail

OpenConnection

public static java.sql.Connection OpenConnection(Configuration config)
                                          throws java.sql.SQLException
Open a connection using URL specified in configuration bundle

Parameters:
config - configuration bundle
Returns:
a connection (session) with the specific database
Throws:
java.sql.SQLException - if there is a SQL error happens

OpenConnection

public 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
Open a connection to a specified URL of the database and specifying a JDBC driver

Parameters:
driverName - JDBC connection driver
url - JDBC connection URL
userName - user name for the DB
password - password for the DB
Returns:
a connection (session) with the specific database
Throws:
java.sql.SQLException - if there is a SQL error happens

CloseConnection

public static void CloseConnection(java.sql.Connection conn)
                            throws java.sql.SQLException
Close a specified connection (session) with a database

Parameters:
conn - database connection
Throws:
java.sql.SQLException - if there is a SQL error happens

FormatSqlStr

public static java.lang.String FormatSqlStr(java.lang.String inStr)
Format a String to SQL standard format

Parameters:
inStr - input sql query string
Returns:
formatted sql query string

SubmitDML

static void SubmitDML(java.lang.String query,
                      Configuration config)
Submit a query to a specific database.

Parameters:
query - a SQL query to be submitted
config - a configuration object

LexAccess Java
2006 Version

Submit a bug or feature

Copyright © 2006 National Library of Medicine