DEPRECATED Use com.bea.p13n.util.jdbc.JdbcHelper
Object
Object
JdbcHelper
Field Summary |
public static final boolean |
|
public static final boolean |
|
public static final |
|
Constructor Summary |
|
Method Summary |
public static void |
|
public static void | |
public static void | |
public static |
|
public static | |
public static |
|
public static |
|
public static |
|
public static double | |
public static double | |
public static float | |
public static float | |
public static int | |
public static int | |
public static long | |
public static long | |
public static boolean |
|
public static void |
|
public static void |
|
public static void |
|
public static boolean |
|
Methods from class java.lang. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final boolean shouldUseClobsForReads
This variable will initialized from the "commerce.jdbc.read.shouldUseClobs" property in weblogiccommerce.properties. Defaults to false
public static final boolean shouldUseClobsForWrites
This variable will initialized from the "commerce.jdbc.write.shouldUseClobs" property in weblogiccommerce.properties. Defaults to false
public static final Boolean
supportsLikeEscapeClause
This variable will initialized from the "commerce.jdbc.supportsLikeEscapeClause" property in weblogiccommerce.properties.
If this is null, then no configuration was specified and the JDBC connection should be queries. Otherwise, this will be true or false.
Constructor Detail |
public JdbcHelper()
Method Detail |
DEPRECATED
public static void close(Connection
con)
Close a connection, ignoring any errors.
DEPRECATED
public static void close(Statement
stmt)
Close a statement, ignoring any errors.
DEPRECATED
public static void close(ResultSet
rs)
Close a result set, ignoring any errors.
DEPRECATED
public staticConvenience method for de-serializing an object from a JDBC source. Note: This method may be able to use PipedOutputStream and PipedInputStream.Object
deserialize(ResultSet
rs, int index)
throwsSQLException
,IOException
,StreamCorruptedException
,ClassNotFoundException
SQLException
IOException
StreamCorruptedException
ClassNotFoundException
DEPRECATED
public staticGet the value of a CLOB column as a string.String
getClob(ResultSet
rs, int index)
throwsSQLException
This is controlled by the value of JdbcHelper.shouldUseClobsForReads
.
SQLException
DEPRECATED
public staticGet the value of a CLOB column as a reader.Reader
getClobReader(ResultSet
rs, int index)
throwsSQLException
This is controlled by the value of JdbcHelper.shouldUseClobsForReads
.
SQLException
DEPRECATED
public staticGet a connection from a DataSource with retry and timeout logic.Connection
getConnection(DataSource
src, int maxRetries, long waitTime)
throwsSQLException
This will retry upto maxRetries. Additionally, it will only retry for waitTime number of milliseconds (as best as possible -- it might be longer, but will not be less).
This will always try at least once to get a connection. Use maxRetries=0 for only a single attempt.
This works with both transactional and non-transaction DataSources tied to WLS connection pools. In WLS, transactional DataSources always internally wait 5 seconds for a new connection; non-transaction DataSources don't wait at all.
SQLException
Related Topics
JdbcHelper.isNoResourceException(SQLException)
DEPRECATED
public staticGet a connection from a DataSource with retry logic.Connection
getConnection(DataSource
src, int maxRetries)
throwsSQLException
SQLException
DEPRECATED
public static double getDouble(Retrieve a double value from the ResultSet at the given index.ResultSet
rs, int index)
throwsSQLException
This will validate if the underlying column was null.
SQLException
DEPRECATED
public static double getDouble(Retrieve a double value from the ResultSet at the given column.ResultSet
rs,String
colName)
throwsSQLException
This will validate if the underlying column was null.
SQLException
DEPRECATED
public static float getFloat(Retrieve a float value from the ResultSet at the given index.ResultSet
rs, int index)
throwsSQLException
This will validate if the underlying column was null.
SQLException
DEPRECATED
public static float getFloat(Retrieve a float value from the ResultSet at the given column.ResultSet
rs,String
colName)
throwsSQLException
This will validate if the underlying column was null.
SQLException
DEPRECATED
public static int getInt(Retrieve an int value from the ResultSet at the given index.ResultSet
rs, int index)
throwsSQLException
This will validate if the underlying column was null.
SQLException
DEPRECATED
public static int getInt(Retrieve an int value from the ResultSet at the given column.ResultSet
rs,String
colName)
throwsSQLException
This will validate if the underlying column was null.
SQLException
DEPRECATED
public static long getLong(Retrieve a long value from the ResultSet at the given index.ResultSet
rs, int index)
throwsSQLException
This will validate if the underlying column was null.
SQLException
DEPRECATED
public static long getLong(Retrieve a long value from the ResultSet at the given column.ResultSet
rs,String
colName)
throwsSQLException
This will validate if the underlying column was null.
SQLException
DEPRECATED
public static boolean isNoResourceException(SQLException
ex)
Tell if a SQLException is telling that no resources/connections are
available right now.
When WLS doesn't have an available connection for a DataSource (either TX or non-TX), it will throw a SQLException with a message following this regular expression: "ResourceException.+[Nn]o.+available". That seems to the only way to tell if a connection wasn't availble from the underlying pool.
DEPRECATED
public static void serialize(Convenience method for serializing an object to a JDBC stream. Serializes the object and calls setBinaryStream() on the prepared statement. The data will be written out later when the statment is executed. Note: getBinaryStream() requires the size of the data bytes, so cannot use PipeInputStream, PipeOutputStreamPreparedStatement
ps, int index,Serializable
obj)
throwsSQLException
,IOException
SQLException
IOException
DEPRECATED
public static void setClob(Set the value of a CLOB column with a string.PreparedStatement
stmt, int index,String
str)
throwsSQLException
This is controlled by the value of JdbcHelper.shouldUseClobsForWrites
.
SQLException
DEPRECATED
public static void setClob(Set the value of a CLOB column with an input reader.PreparedStatement
stmt, int index,Reader
in, int length)
throwsSQLException
This is controlled by the value of JdbcHelper.shouldUseClobsForWrites
.
SQLException
DEPRECATED
public static boolean supportsLikeEscapeClause(Connection
con)
Determine if the given connection supports the LIKE ESCAPE clause.
This first checks the JdbcHelper.supportsLikeEscapeClause
varaible. It
then checks with the Connection DatabaseMetaData.