oemware.core.dao
Class DbTools

java.lang.Object
  extended by oemware.core.dao.DbTools

public final class DbTools
extends java.lang.Object

The db tools object.

Version:
$Id: DbTools.java 13 2008-06-15 19:43:04Z oemware $

Constructor Summary
DbTools()
           
 
Method Summary
static void close(java.sql.ResultSet pResultSet, java.sql.Statement pStatement)
          Close the JDBC objects.
static void close(java.sql.ResultSet pResultSet, java.sql.Statement pStatement, java.sql.Connection pConnection)
          Close the JDBC objects.
static void close(java.sql.Statement pStatement, java.sql.Connection pConnection)
          Close the JDBC objects.
static void closeConnection(java.sql.Connection pConnection)
          Close the connection.
static void closeResultSet(java.sql.ResultSet pResultSet)
          Close the result set.
static void closeStatement(java.sql.Statement pStatement)
          Close the statement.
static java.sql.Connection getConnection(java.lang.String pUsername, java.lang.String pPassword, java.lang.String pUrl, java.lang.String pDriver)
          Create a new db connection.
static java.sql.Timestamp getNow()
          Returns the current timestamp object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DbTools

public DbTools()
Method Detail

getConnection

public static final java.sql.Connection getConnection(java.lang.String pUsername,
                                                      java.lang.String pPassword,
                                                      java.lang.String pUrl,
                                                      java.lang.String pDriver)
                                               throws DaoException
Create a new db connection. You must insert the JDBC driver jar your classpath.

Sample Url: jdbc:mysql://localhost/DATABASE_NAME?autoReconnect=true&useUnicode=true&characterEncoding=utf8
Samble Driver: com.mysql.jdbc.Driver

Parameters:
pUsername - The username.
pPassword - The password.
pUrl - The JDBC url.
pDriver - The driver name.
Throws:
DaoException

getNow

public static final java.sql.Timestamp getNow()
Returns the current timestamp object.

Returns:
The current timestamp.

close

public static final void close(java.sql.ResultSet pResultSet,
                               java.sql.Statement pStatement,
                               java.sql.Connection pConnection)
                        throws DaoException
Close the JDBC objects.

Parameters:
pResultSet - The result set.
pStatement - The statement.
pConnection - The connection.
Throws:
DaoException

close

public static final void close(java.sql.ResultSet pResultSet,
                               java.sql.Statement pStatement)
                        throws DaoException
Close the JDBC objects.

Parameters:
pResultSet - The result set.
pStatement - The statement.
Throws:
DaoException

close

public static final void close(java.sql.Statement pStatement,
                               java.sql.Connection pConnection)
                        throws DaoException
Close the JDBC objects.

Parameters:
pStatement - The statement.
pConnection - The connection.
Throws:
DaoException

closeConnection

public static final void closeConnection(java.sql.Connection pConnection)
                                  throws DaoException
Close the connection.

Parameters:
pConnection - The connection.
Throws:
DaoException

closeStatement

public static final void closeStatement(java.sql.Statement pStatement)
                                 throws DaoException
Close the statement.

Parameters:
pStatement - The statement.
Throws:
DaoException

closeResultSet

public static final void closeResultSet(java.sql.ResultSet pResultSet)
                                 throws DaoException
Close the result set.

Parameters:
pResultSet - The result set.
Throws:
DaoException


Copyright © 2008 Deft Labs - Released under LGPL, Version 3.0