org.dbforms.util
Class SqlUtil

java.lang.Object
  extended by org.dbforms.util.SqlUtil

public class SqlUtil
extends Object

this utility-class provides convenience methods for SQL related tasks

Author:
Joe Peer, Eric Pugh

Constructor Summary
SqlUtil()
           
 
Method Summary
static void closeConnection(Connection con)
          Close the input connection
static void logSqlException(SQLException e)
          Log the SQLException stacktrace and do the same for all the nested exceptions.
static void logSqlException(SQLException e, String desc)
          Log the SQLException stacktrace (adding the input description to the first log statement) and do the same for all the nested exceptions.
static InputStream readDbFieldBlob(ResultSet rs)
          Read the database field and write to the client its content
static FileInputStream readDiskBlob(String fileName, String directory, String defVal)
          Read the blob field from the filesystem and write to the client its content.
static FileHolder readFileHolderBlob(ResultSet rs)
          Read the database field and write to the client its content
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SqlUtil

public SqlUtil()
Method Detail

closeConnection

public static final void closeConnection(Connection con)
Close the input connection

Parameters:
con - the connection to close

logSqlException

public static final void logSqlException(SQLException e,
                                         String desc)
Log the SQLException stacktrace (adding the input description to the first log statement) and do the same for all the nested exceptions.

Parameters:
e - the SQL exception to log
desc - the exception description

logSqlException

public static final void logSqlException(SQLException e)
Log the SQLException stacktrace and do the same for all the nested exceptions.

Parameters:
e - the SQL exception to log

readFileHolderBlob

public static FileHolder readFileHolderBlob(ResultSet rs)
                                     throws IOException,
                                            SQLException
Read the database field and write to the client its content

Parameters:
rs - Description of the Parameter
fileName - is the filename or NULL in the classic (Fileholder-based) BLOB handling
Throws:
IOException - Description of the Exception
SQLException - Description of the Exception

readDbFieldBlob

public static InputStream readDbFieldBlob(ResultSet rs)
                                   throws IOException,
                                          SQLException
Read the database field and write to the client its content

Parameters:
rs - Description of the Parameter
fileName - is the filename or NULL in the classic (Fileholder-based) BLOB handling
Throws:
IOException - Description of the Exception
SQLException - Description of the Exception

readDiskBlob

public static FileInputStream readDiskBlob(String fileName,
                                           String directory,
                                           String defVal)
                                    throws FileNotFoundException,
                                           IOException
Read the blob field from the filesystem and write to the client its content.

Parameters:
fileName - Description of the Parameter
directory - Description of the Parameter
defVal - Default value of the file tag
Throws:
FileNotFoundException - Description of the Exception
IOException - Description of the Exception


Copyright © 2002-2006 DbForms. All Rights Reserved.