Class JDBCLookup
java.lang.Object
com.swiftmq.impl.streams.comp.jdbc.JDBCLookup
Facade to perform queries on a JDBC connected database.
- Author:
- IIT Software GmbH, Muenster/Germany, (c) 2016, All Rights Reserved
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the underlying JDBC connection.void
collect
(long interval) Internal use.connect()
Performs a connect to the database.Sets the JDBC driver class name.Sets the JDBC password.Performs a select query and returns a Memory with the result.Sets the database schema name.Sets the JDBC URL.Sets the JDBC username.
-
Constructor Details
-
JDBCLookup
Interval use.
-
-
Method Details
-
driver
Sets the JDBC driver class name.- Parameters:
driver
- class name- Returns:
- JDBCLookup
-
url
Sets the JDBC URL.- Parameters:
url
- JDBC URL- Returns:
- JDBCLookup
-
schema
Sets the database schema name.- Parameters:
schema
- schema name- Returns:
- JDBCLoopkup
-
username
Sets the JDBC username.- Parameters:
username
- JDBC username- Returns:
- JDBCLookup
-
password
Sets the JDBC password.- Parameters:
password
- JDBC password- Returns:
- JDBCLookup
-
connect
Performs a connect to the database.- Returns:
- JDBCLookup
- Throws:
Exception
- if any error occurs
-
query
Performs a select query and returns a Memory with the result. For every selected database row a single Message is created. For each column of a row a message property is created with the name of the column and the value as the corresponding Java type (String, Integer, Long, Double, Float). A column which returns BigDecimal as value type is converted into a Double.- Parameters:
sql
- Select statement- Returns:
- Memory with the result
- Throws:
Exception
- if any error occurs
-
collect
public void collect(long interval) Internal use. -
close
public void close()Closes the underlying JDBC connection. This is automatically called when the stream is stopped but can also be called from a script if the JDBCLookup object isn't used anymore.
-