dea.common
Class Db

java.lang.Object
  extended bydea.common.Db
All Implemented Interfaces:
IDebugLevels

public class Db
extends java.lang.Object
implements IDebugLevels

Title: DB
Description: Class of DB util methods
Copyright: Copyright (c) 2001-2004
Company: RMRR

@author David Abigt
@version 1.0


Field Summary
 
Fields inherited from interface dea.common.IDebugLevels
BASIC, DEBUG_ALL, ERROR, METH_DETAIL, METH_ENTER, METH_EXIT, METH_EXT, METH_GET, METH_SET, METH_VARS, SHOW_PASS
 
Constructor Summary
Db()
           
 
Method Summary
 void close()
           
 java.sql.Connection doConnect()
          Get a connection to the DB.
 java.sql.Connection getConnection()
          returns the connection and creates a new one if needed.
 java.lang.String getDbName()
           
 java.lang.String getDbUrl()
           
static boolean mkdirs(java.lang.String s)
          Creates subdirectories as needed to complete path.
 long nextPk(java.lang.String tableName)
          Gets next primary key for insert.
 void setConnection(java.sql.Connection newConnection)
           
 void setDbName(java.lang.String newDbName)
           
 void setDbUrl(java.lang.String newDbUrl)
           
static java.lang.String sqlStr(java.lang.String parm)
          Format String parm for SQL statement
static java.lang.String sqlStr(java.sql.Timestamp parm)
          Format Timestamp parm for SQL statement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Db

public Db()
Method Detail

getConnection

public java.sql.Connection getConnection()
returns the connection and creates a new one if needed.

Returns:
Connection

setConnection

public void setConnection(java.sql.Connection newConnection)

getDbUrl

public java.lang.String getDbUrl()

setDbUrl

public void setDbUrl(java.lang.String newDbUrl)

getDbName

public java.lang.String getDbName()

setDbName

public void setDbName(java.lang.String newDbName)

doConnect

public java.sql.Connection doConnect()
                              throws java.sql.SQLException,
                                     java.lang.ClassNotFoundException
Get a connection to the DB.

Throws:
java.sql.SQLException
java.lang.ClassNotFoundException

mkdirs

public static boolean mkdirs(java.lang.String s)
                      throws java.io.IOException
Creates subdirectories as needed to complete path.

Parameters:
s - String representing the directory path that needs to be created.
Returns:
sucess / failure
Throws:
java.io.IOException - if unable to create directory

sqlStr

public static java.lang.String sqlStr(java.lang.String parm)
Format String parm for SQL statement

Parameters:
parm -
Returns:
String

sqlStr

public static java.lang.String sqlStr(java.sql.Timestamp parm)
Format Timestamp parm for SQL statement

Parameters:
parm -
Returns:
String

nextPk

public long nextPk(java.lang.String tableName)
Gets next primary key for insert. For a true production env this should call a stored procedure

Parameters:
tableName -
Returns:
long

close

public void close()


Copyright © 2001-2005 Round Mountain Rescue Ranch. All Rights Reserved.