com.novell.nds.dirxml.driver.jdbc.db
Class DBLib

java.lang.Object
  extended bycom.novell.nds.dirxml.driver.jdbc.db.DBLib

public abstract class DBLib
extends Object

A database-independent library of useful JDBC methods.

To be installed on DB2 database server. Must be compiled for 1.1.8 VM.


Method Summary
static Connection Close(Connection connection)
          Closes open connection.
static ResultSet Close(ResultSet rs)
          Closes open results set.
static Statement Close(Statement stmt)
          Closes open statement.
static String DELIMIT(String undelimited)
          Encloses undelimited in double quotes "".
static boolean IsNotValue(String value)
          Is the passed String is null, empty string, or whitespace?
static boolean IsValue(String value)
          Is the passed String is something other than null, empty string, or whitespace?
static boolean LDAPMustEscapeDelimited(char ch)
          Does a character need to be escaped if included in an LDAP-delimited string?
static Date NewDate(String odbcDate)
          Instantiates a date object.
static Time NewTime(String odbcTime)
          Instantiates a time object.
static Timestamp NewTimestamp(String odbcTimestamp)
          Instantiates a timestamp object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

IsValue

public static boolean IsValue(String value)
Is the passed String is something other than null, empty string, or whitespace?

Parameters:
value - the value in question
Returns:
true if value is a value; false otherwise

IsNotValue

public static boolean IsNotValue(String value)
Is the passed String is null, empty string, or whitespace?

Parameters:
value - the value in question
Returns:
true if value is not a value; false otherwise

Close

public static Connection Close(Connection connection)
Closes open connection. Useful in a finally block. Thrown SQLExceptions are ignored.

Parameters:
connection - may be null

Close

public static Statement Close(Statement stmt)
Closes open statement. Useful in a finally block. Thrown SQLExceptions are ignored.

Parameters:
stmt - may be null

Close

public static ResultSet Close(ResultSet rs)
Closes open results set. Useful in a finally block. Thrown SQLExceptions are ignored.

Parameters:
rs - may be null

LDAPMustEscapeDelimited

public static boolean LDAPMustEscapeDelimited(char ch)
Does a character need to be escaped if included in an LDAP-delimited string?

Parameters:
ch - the character to evaluate
Returns:
true if it does; false otherwise

DELIMIT

public static String DELIMIT(String undelimited)
Encloses undelimited in double quotes "". Provides a simple alternative to escaping LDAP DN characters {'"' | '\' | ',' | '+' | '=' | '<' | '>' | ';'}.

Parameters:
undelimited - an unquoted string; may be null
Returns:
null if undelimited is null; undelimited enclosed in "" otherwise.

NewTimestamp

public static Timestamp NewTimestamp(String odbcTimestamp)
                              throws IllegalArgumentException
Instantiates a timestamp object.

Parameters:
odbcTimestamp - a string of the format yyyy-mm-dd hh:mm:ss.fffffffff; MUST not be null
Returns:
will not return null
Throws:
IllegalArgumentException - if odbcTimestamp does not have the format yyyy-mm-dd hh:mm:ss.fffffffff

NewTime

public static Time NewTime(String odbcTime)
                    throws IllegalArgumentException
Instantiates a time object.

Parameters:
odbcTime - a string of the format hh:mm:ss; MUST not be null
Returns:
will not return null
Throws:
IllegalArgumentException - if odbcTime does not have the format hh:mm:ss

NewDate

public static Date NewDate(String odbcDate)
                    throws IllegalArgumentException
Instantiates a date object.

Parameters:
odbcDate - a string of the format yyyy-mm-dd; MUST not be null
Returns:
will not return null
Throws:
IllegalArgumentException - if odbcDate does not have the format yyyy-mm-dd