|
Copyright © 2000, 2008, Oracle and/or its affiliates. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.beasys.commerce.util.JdbcHelper
JdbcHelper
@Deprecated public class JdbcHelper
Field Summary | |
---|---|
static boolean |
shouldUseClobsForReads
Deprecated Controls whether we should use the Clob object or the ResultSet.getString() method to retrieve CLOB columns. |
static boolean |
shouldUseClobsForWrites
Deprecated Controls whether we should use the setCharacterStream() or the ResultSet.setString() method to set CLOB columns. |
static Boolean |
supportsLikeEscapeClause
Deprecated Determine if the server configuration supports the LIKE ESCAPE clause. |
Constructor Summary | |
---|---|
JdbcHelper()
Deprecated Helper constructor comment. |
Method Summary | |
---|---|
static void |
close(Connection con)
Deprecated |
static void |
close(ResultSet rs)
Deprecated |
static void |
close(Statement stmt)
Deprecated |
static Object |
deserialize(ResultSet rs,
int index)
Deprecated |
static String |
getClob(ResultSet rs,
int index)
Deprecated |
static Reader |
getClobReader(ResultSet rs,
int index)
Deprecated |
static Connection |
getConnection(DataSource src,
int maxRetries)
Deprecated |
static Connection |
getConnection(DataSource src,
int maxRetries,
long waitTime)
Deprecated |
static double |
getDouble(ResultSet rs,
int index)
Deprecated |
static double |
getDouble(ResultSet rs,
String colName)
Deprecated |
static float |
getFloat(ResultSet rs,
int index)
Deprecated |
static float |
getFloat(ResultSet rs,
String colName)
Deprecated |
static int |
getInt(ResultSet rs,
int index)
Deprecated |
static int |
getInt(ResultSet rs,
String colName)
Deprecated |
static long |
getLong(ResultSet rs,
int index)
Deprecated |
static long |
getLong(ResultSet rs,
String colName)
Deprecated |
static boolean |
isNoResourceException(SQLException ex)
Deprecated |
static void |
serialize(PreparedStatement ps,
int index,
Serializable obj)
Deprecated |
static void |
setClob(PreparedStatement stmt,
int index,
Reader in,
int length)
Deprecated |
static void |
setClob(PreparedStatement stmt,
int index,
String str)
Deprecated |
static boolean |
supportsLikeEscapeClause(Connection con)
Deprecated |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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.
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
Constructor Detail |
---|
public JdbcHelper()
Method Detail |
---|
public static Connection getConnection(DataSource src, int maxRetries, long waitTime) throws SQLException
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.
src
- the data source.maxRetries
- the maximum number of times to retry (less than 0 for
infinite).waitTime
- the maximum number of milliseconds to try (less than 0
for infinite).
SQLException
- thrown on an error getting a connection.isNoResourceException(java.sql.SQLException)
public static Connection getConnection(DataSource src, int maxRetries) throws SQLException
src
- the data source.maxRetries
- the maximum number of times to retry (less than 0 for
infinite).
SQLException
- thrown on an error getting a connection.public static boolean isNoResourceException(SQLException ex)
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.
public static void serialize(PreparedStatement ps, int index, Serializable obj) throws SQLException, IOException
ps
- PreparedStatement.index
- placeholder index of the serialized object.obj
- Object to be serialized.
SQLException
IOException
public static Object deserialize(ResultSet rs, int index) throws SQLException, IOException, StreamCorruptedException, ClassNotFoundException
ps
- Result Set.index
- table column index.
SQLException
IOException
StreamCorruptedException
ClassNotFoundException
public static boolean supportsLikeEscapeClause(Connection con)
This first checks the supportsLikeEscapeClause
varaible. It
then checks with the Connection DatabaseMetaData.
public static int getInt(ResultSet rs, int index) throws SQLException
This will validate if the underlying column was null.
rs
- the result set.index
- the column index.
SQLException
- from retrieving the column.public static int getInt(ResultSet rs, String colName) throws SQLException
This will validate if the underlying column was null.
rs
- the result set.colName
- the column name.
SQLException
- from retrieving the column.public static long getLong(ResultSet rs, int index) throws SQLException
This will validate if the underlying column was null.
rs
- the result set.index
- the column index.
SQLException
- from retrieving the column.public static long getLong(ResultSet rs, String colName) throws SQLException
This will validate if the underlying column was null.
rs
- the result set.colName
- the column name.
SQLException
- from retrieving the column.public static float getFloat(ResultSet rs, int index) throws SQLException
This will validate if the underlying column was null.
rs
- the result set.index
- the column index.
SQLException
- from retrieving the column.public static float getFloat(ResultSet rs, String colName) throws SQLException
This will validate if the underlying column was null.
rs
- the result set.colName
- the column name.
SQLException
- from retrieving the column.public static double getDouble(ResultSet rs, int index) throws SQLException
This will validate if the underlying column was null.
rs
- the result set.index
- the column index.
SQLException
- from retrieving the column.public static double getDouble(ResultSet rs, String colName) throws SQLException
This will validate if the underlying column was null.
rs
- the result set.colName
- the column name.
SQLException
- from retrieving the column.public static String getClob(ResultSet rs, int index) throws SQLException
This is controlled by the value of shouldUseClobsForReads
.
rs
- the result set.index
- the column index in the result set.
SQLException
- thrown on an error.public static Reader getClobReader(ResultSet rs, int index) throws SQLException
This is controlled by the value of shouldUseClobsForReads
.
rs
- the result set.index
- the column index in the result set.
SQLException
- thrown on an error.public static void setClob(PreparedStatement stmt, int index, String str) throws SQLException
This is controlled by the value of shouldUseClobsForWrites
.
stmt
- the prepared statement.index
- the column index.str
- the CLOB string.
SQLException
- thrown on an error.public static void setClob(PreparedStatement stmt, int index, Reader in, int length) throws SQLException
This is controlled by the value of shouldUseClobsForWrites
.
stmt
- the prepared statement.index
- the column index.in
- the CLOB input reader.
SQLException
- thrown on an error.public static void close(Connection con)
public static void close(Statement stmt)
public static void close(ResultSet rs)
|
Copyright © 2000, 2008, Oracle and/or its affiliates. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |