Package org.frankframework.util
Class JdbcUtil
java.lang.Object
org.frankframework.util.JdbcUtil
Database-oriented utility functions.
- Since:
- 4.1
- Author:
- Gerrit van Brakel
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
applyParameters
(IDbmsSupport dbmsSupport, PreparedStatement statement, ParameterList parameters, Message message, PipeLineSession session) static void
applyParameters
(IDbmsSupport dbmsSupport, PreparedStatement statement, ParameterValueList parameters, PipeLineSession session) static void
close
(Connection connection) static void
fullClose
(Connection connection, ResultSet rs) static void
fullClose
(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 String
getBlobAsString
(IDbmsSupport dbmsSupport, ResultSet rs, int column, String charset, boolean blobIsCompressed, boolean blobSmartGet, boolean encodeBlobBase64) static String
getBlobAsString
(IDbmsSupport dbmsSupport, ResultSet rs, String column, String charset, boolean blobIsCompressed, boolean blobSmartGet, boolean encodeBlobBase64) static InputStream
getBlobInputStream
(IDbmsSupport dbmsSupport, ResultSet rs, int column, boolean blobIsCompressed) static InputStream
getBlobInputStream
(IDbmsSupport dbmsSupport, ResultSet rs, String column, boolean blobIsCompressed) static OutputStream
getBlobOutputStream
(IDbmsSupport dbmsSupport, Object blobUpdateHandle, ResultSet rs, int columnIndex, boolean compressBlob) static Reader
getBlobReader
(IDbmsSupport dbmsSupport, ResultSet rs, int column, String charset, boolean blobIsCompressed) static String
getClobAsString
(IDbmsSupport dbmsSupport, ResultSet rs, int columnIndex, boolean xmlEncode) static String
getValue
(IDbmsSupport dbmsSupport, ResultSet rs, int colNum, ResultSetMetaData rsmeta, String blobCharset, boolean decompressBlobs, String nullValue, boolean trimSpaces, boolean getBlobSmart, boolean encodeBlobBase64) static boolean
isQueryResultEmpty
(Connection connection, String query) static boolean
isSQLTypeNumeric
(int sqlType) static SQLType
mapParameterTypeToSqlType
(IDbmsSupport dbmsSupport, ParameterType parameterType) static void
setParameter
(PreparedStatement statement, int parameterIndex, String value, boolean parameterTypeMatchRequired) static void
streamBlob
(IDbmsSupport dbmsSupport, ResultSet rs, int columnIndex, String charset, boolean blobIsCompressed, Base64Pipe.Direction blobBase64Direction, Object target, boolean close) static void
streamClob
(IDbmsSupport dbmsSupport, ResultSet rs, int column, Object target, boolean close) static String
warningsToString
(SQLWarning warnings) Deprecated.static void
warningsToXml
(SQLWarning warnings, XmlBuilder parent) Deprecated.static XmlBuilder
warningsToXmlBuilder
(SQLWarning warnings) Deprecated.
-
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:
IOException
SQLException
-
getBlobInputStream
public static InputStream getBlobInputStream(IDbmsSupport dbmsSupport, ResultSet rs, int column, boolean blobIsCompressed) throws SQLException, JdbcException - Throws:
SQLException
JdbcException
-
getBlobInputStream
public static InputStream getBlobInputStream(IDbmsSupport dbmsSupport, ResultSet rs, String column, boolean blobIsCompressed) throws SQLException, JdbcException - Throws:
SQLException
JdbcException
-
getBlobReader
public static Reader getBlobReader(IDbmsSupport dbmsSupport, ResultSet rs, int column, String charset, boolean blobIsCompressed) throws IOException, JdbcException, SQLException - Throws:
IOException
JdbcException
SQLException
-
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:
JdbcException
SQLException
IOException
-
streamClob
public static void streamClob(IDbmsSupport dbmsSupport, ResultSet rs, int column, Object target, boolean close) throws DbmsException, SQLException, IOException - Throws:
DbmsException
SQLException
IOException
-
getBlobAsString
public static String getBlobAsString(IDbmsSupport dbmsSupport, ResultSet rs, int column, String charset, boolean blobIsCompressed, boolean blobSmartGet, boolean encodeBlobBase64) throws IOException, JdbcException, SQLException - Throws:
IOException
JdbcException
SQLException
-
getBlobAsString
public static String getBlobAsString(IDbmsSupport dbmsSupport, ResultSet rs, String column, String charset, boolean blobIsCompressed, boolean blobSmartGet, boolean encodeBlobBase64) throws IOException, JdbcException, SQLException - Throws:
IOException
JdbcException
SQLException
-
getBlobOutputStream
public static OutputStream getBlobOutputStream(IDbmsSupport dbmsSupport, Object blobUpdateHandle, ResultSet rs, int columnIndex, boolean compressBlob) throws SQLException, DbmsException - Throws:
SQLException
DbmsException
-
getClobAsString
public static String getClobAsString(IDbmsSupport dbmsSupport, ResultSet rs, int columnIndex, boolean xmlEncode) throws IOException, JdbcException, SQLException - Throws:
IOException
JdbcException
SQLException
-
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:
JdbcException
ParameterException
-
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 - Throws:
SQLException
-
isSQLTypeNumeric
public static boolean isSQLTypeNumeric(int sqlType)
-