net.sf.log4jdbc
Class JdbcUtils

java.lang.Object
  extended by net.sf.log4jdbc.JdbcUtils

public abstract class JdbcUtils
extends Object

Generic utility methods for working with JDBC. Mainly for internal use within the [spring] framework, but also useful for custom JDBC access code. Copied from Spring JdbcUtils by Tim Azzopardi for log4jdbc

Author:
Thomas Risberg, Juergen Hoeller

Constructor Summary
JdbcUtils()
           
 
Method Summary
static Object getResultSetValue(ResultSet rs, int index)
          Retrieve a JDBC column value from a ResultSet, using the most appropriate value type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JdbcUtils

public JdbcUtils()
Method Detail

getResultSetValue

public static Object getResultSetValue(ResultSet rs,
                                       int index)
                                throws SQLException
Retrieve a JDBC column value from a ResultSet, using the most appropriate value type. The returned value should be a detached value object, not having any ties to the active ResultSet: in particular, it should not be a Blob or Clob object but rather a byte array respectively String representation.

Uses the getObject(index) method, but includes additional "hacks" to get around Oracle 10g returning a non-standard object for its TIMESTAMP datatype and a java.sql.Date for DATE columns leaving out the time portion: These columns will explicitly be extracted as standard java.sql.Timestamp object.

Parameters:
rs - is the ResultSet holding the data
index - is the column index
Returns:
the value object
Throws:
SQLException - if thrown by the JDBC API
See Also:
Blob, Clob, Timestamp


Copyright © 2012. All Rights Reserved.