Package org.frankframework.util
Class JdbcUtil
java.lang.Object
org.frankframework.util.JdbcUtil
Database-oriented utility functions.
- Since:
- 4.1
- Author:
- Gerrit van Brakel
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidapplyParameters(IDbmsSupport dbmsSupport, PreparedStatement statement, ParameterList parameters, Message message, PipeLineSession session) static voidapplyParameters(IDbmsSupport dbmsSupport, PreparedStatement statement, ParameterValueList parameters, PipeLineSession session) static voidclose(Connection connection) static voidfullClose(Connection connection, ResultSet rs) static voidfullClose(Connection connection, Statement statement) Note: Depending on the connect pool used (for example with Tomcat 7) the connection retrieved from the statement will be the direct connection instead of the proxied connection.static StringgetBlobAsString(IDbmsSupport dbmsSupport, ResultSet rs, int column, String charset, boolean blobIsCompressed, boolean blobSmartGet, boolean encodeBlobBase64) static StringgetBlobAsString(IDbmsSupport dbmsSupport, ResultSet rs, String column, String charset, boolean blobIsCompressed, boolean blobSmartGet, boolean encodeBlobBase64) static InputStreamgetBlobInputStream(IDbmsSupport dbmsSupport, ResultSet rs, int column, boolean blobIsCompressed) static InputStreamgetBlobInputStream(IDbmsSupport dbmsSupport, ResultSet rs, String column, boolean blobIsCompressed) static OutputStreamgetBlobOutputStream(IDbmsSupport dbmsSupport, Object blobUpdateHandle, ResultSet rs, int columnIndex, boolean compressBlob) static ReadergetBlobReader(IDbmsSupport dbmsSupport, ResultSet rs, int column, String charset, boolean blobIsCompressed) static StringgetClobAsString(IDbmsSupport dbmsSupport, ResultSet rs, int columnIndex, boolean xmlEncode) static StringgetValue(IDbmsSupport dbmsSupport, ResultSet rs, int colNum, ResultSetMetaData rsmeta, String blobCharset, boolean decompressBlobs, String nullValue, boolean trimSpaces, boolean getBlobSmart, boolean encodeBlobBase64) static booleanisQueryResultEmpty(Connection connection, String query) static booleanisSQLTypeNumeric(int sqlType) static SQLTypemapParameterTypeToSqlType(IDbmsSupport dbmsSupport, ParameterType parameterType) static voidsetParameter(PreparedStatement statement, int parameterIndex, String value, boolean parameterTypeMatchRequired) Set a parameter in a prepared statement.static voidsetParameter(PreparedStatement statement, int parameterIndex, String value, boolean parameterTypeMatchRequired, ParameterMetaData parameterMetaData) Set a parameter in a prepared statement.static voidstreamBlob(IDbmsSupport dbmsSupport, ResultSet rs, int columnIndex, String charset, boolean blobIsCompressed, Base64Pipe.Direction blobBase64Direction, Object target, boolean close) static voidstreamClob(IDbmsSupport dbmsSupport, ResultSet rs, int column, Object target, boolean close) static StringwarningsToString(SQLWarning warnings) Deprecated.static voidwarningsToXml(SQLWarning warnings, XmlBuilder parent) Deprecated.static XmlBuilderwarningsToXmlBuilder(SQLWarning warnings) Deprecated.
-
Field Details
-
DATEFORMAT_DATE_TIME_FORMATTER
-
TIMESTAMP_DATE_TIME_FORMATTER
-
-
Constructor Details
-
JdbcUtil
public JdbcUtil()
-
-
Method Details
-
warningsToString
Deprecated. -
warningsToXml
Deprecated. -
warningsToXmlBuilder
Deprecated. -
getValue
public static String getValue(IDbmsSupport dbmsSupport, ResultSet rs, int colNum, ResultSetMetaData rsmeta, String blobCharset, boolean decompressBlobs, String nullValue, boolean trimSpaces, boolean getBlobSmart, boolean encodeBlobBase64) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getBlobInputStream
public static InputStream getBlobInputStream(IDbmsSupport dbmsSupport, ResultSet rs, int column, boolean blobIsCompressed) throws SQLException, JdbcException - Throws:
SQLExceptionJdbcException
-
getBlobInputStream
public static InputStream getBlobInputStream(IDbmsSupport dbmsSupport, ResultSet rs, String column, boolean blobIsCompressed) throws SQLException, JdbcException - Throws:
SQLExceptionJdbcException
-
getBlobReader
public static Reader getBlobReader(IDbmsSupport dbmsSupport, ResultSet rs, int column, String charset, boolean blobIsCompressed) throws IOException, JdbcException, SQLException - Throws:
IOExceptionJdbcExceptionSQLException
-
streamBlob
public static void streamBlob(IDbmsSupport dbmsSupport, ResultSet rs, int columnIndex, String charset, boolean blobIsCompressed, Base64Pipe.Direction blobBase64Direction, Object target, boolean close) throws JdbcException, SQLException, IOException - Throws:
JdbcExceptionSQLExceptionIOException
-
streamClob
public static void streamClob(IDbmsSupport dbmsSupport, ResultSet rs, int column, Object target, boolean close) throws DbmsException, SQLException, IOException - Throws:
DbmsExceptionSQLExceptionIOException
-
getBlobAsString
public static String getBlobAsString(IDbmsSupport dbmsSupport, ResultSet rs, int column, String charset, boolean blobIsCompressed, boolean blobSmartGet, boolean encodeBlobBase64) throws IOException, JdbcException, SQLException - Throws:
IOExceptionJdbcExceptionSQLException
-
getBlobAsString
public static String getBlobAsString(IDbmsSupport dbmsSupport, ResultSet rs, String column, String charset, boolean blobIsCompressed, boolean blobSmartGet, boolean encodeBlobBase64) throws IOException, JdbcException, SQLException - Throws:
IOExceptionJdbcExceptionSQLException
-
getBlobOutputStream
public static OutputStream getBlobOutputStream(IDbmsSupport dbmsSupport, Object blobUpdateHandle, ResultSet rs, int columnIndex, boolean compressBlob) throws SQLException, DbmsException - Throws:
SQLExceptionDbmsException
-
getClobAsString
public static String getClobAsString(IDbmsSupport dbmsSupport, ResultSet rs, int columnIndex, boolean xmlEncode) throws IOException, JdbcException, SQLException - Throws:
IOExceptionJdbcExceptionSQLException
-
fullClose
-
fullClose
Note: Depending on the connect pool used (for example with Tomcat 7) the connection retrieved from the statement will be the direct connection instead of the proxied connection. After a close on this (unproxied) connection the transaction manager isn't able to do a commit anymore. Hence, this method doesn't get it from the statement but has an extra connection parameter.- Parameters:
connection- the proxied/original connection the statement was created withstatement- the statement to close
-
close
-
isQueryResultEmpty
- Throws:
JdbcException
-
applyParameters
public static void applyParameters(IDbmsSupport dbmsSupport, PreparedStatement statement, ParameterList parameters, Message message, PipeLineSession session) throws JdbcException, ParameterException - Throws:
JdbcExceptionParameterException
-
applyParameters
public static void applyParameters(IDbmsSupport dbmsSupport, PreparedStatement statement, ParameterValueList parameters, PipeLineSession session) throws JdbcException - Throws:
JdbcException
-
mapParameterTypeToSqlType
public static SQLType mapParameterTypeToSqlType(IDbmsSupport dbmsSupport, ParameterType parameterType) -
setParameter
public static void setParameter(PreparedStatement statement, int parameterIndex, String value, boolean parameterTypeMatchRequired) throws SQLException Set a parameter in a prepared statement. Optimized for single-parameter statements- Throws:
SQLException
-
setParameter
public static void setParameter(PreparedStatement statement, int parameterIndex, String value, boolean parameterTypeMatchRequired, ParameterMetaData parameterMetaData) throws SQLException Set a parameter in a prepared statement. IfparameterTypeMatchRequired = truethen you should also passParameterMetaData. Intended for use when multiple parameters need to be set in the prepared statement, so that ParameterMetaData is fetched only once. (For some databases every time this is accessed from the statement can mean another network-access and fetching it once for all parameters reduces the network overhead for those).- Throws:
SQLException
-
isSQLTypeNumeric
public static boolean isSQLTypeNumeric(int sqlType)
-