Package com.illumon.iris.importers.util
Class JdbcImport
java.lang.Object
com.illumon.iris.importers.util.ImportBase
com.illumon.iris.importers.util.JdbcImport
public class JdbcImport extends ImportBase
Tools for programmatically executing JDBC batch imports.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JdbcImport.Builder
The Builder class allows setting properties for a JDBC import and provides aJdbcImport.Builder.build()
method which returns a JdbcImport object that will use the configured properties to import batch data. -
Field Summary
Fields Modifier and Type Field Description static com.fishlib.io.logger.Logger
log
Fields inherited from class com.illumon.iris.importers.util.ImportBase
destinationDirectory, destinationPartitions, namespace, outputMode, schemaService, table
-
Method Summary
Modifier and Type Method Description static JdbcImportBuilder
builder(String namespace, String table)
Creates a new JdbcImportBuilder object.static TimeZone
getServerTimeZone(String driver, String connectionUrl, String user, String password)
Utility method to retrieve database server timezone.long
run()
Executes a JDBC batch import as configured for theJdbcImport
object.Methods inherited from class com.illumon.iris.importers.util.ImportBase
getFileList, getImportTableWriterFactory, getSourceFiles
-
Field Details
-
log
public static final com.fishlib.io.logger.Logger log
-
-
Method Details
-
builder
Creates a new JdbcImportBuilder object. Method calls on this object can then be used to configure the import and run it.- Parameters:
namespace
- The String name of the namespace into which data will be imported.table
- The String name of the table into which data will be imported.- Returns:
- A new JdbcImportBuilder object.
-
getServerTimeZone
public static TimeZone getServerTimeZone(String driver, String connectionUrl, String user, String password) throws SQLExceptionUtility method to retrieve database server timezone. Used by default for interpreting dates and times on import.- Parameters:
driver
- A String of the fully qualified class name of the JDBC driver to use.connectionUrl
- A String connection URL whose formatting is specified by the driver being used.- Returns:
- A
TimeZone
- Throws:
SQLException
- if the call fails.
-
run
Executes a JDBC batch import as configured for theJdbcImport
object.- Specified by:
run
in classImportBase
- Returns:
- A long of the number of rows imported.
- Throws:
IOException
- orSQLException
if the import cannot be executed or fails during processing.SQLException
-