public class JdbcDataset extends Dataset
| Modifier and Type | Class and Description |
|---|---|
static class |
JdbcDataset.DatabaseProvider
Enumeration of supported database providers for JDBC datasets.
|
Dataset.ColumnsDataReaderinternalId, internalName, log, TIMESTAMP_FORMATSERIALIZED_CLASS_NAME, TYPEXML_SERIALIZED_CLASS_NAME| Modifier and Type | Method and Description |
|---|---|
DataException |
addExceptionProperties(DataException exception)
Adds this object's current state to a
DataException. |
protected void |
afterColumnStatsLoaded()
Called during the data loading process after all the column stats have been loaded.
|
protected void |
afterLoad()
Called at the end of the data loading process after all the records and column stats have been loaded.
|
protected void |
beforeLoad()
Called at the start of the data loading process, but before any records or column stats have been loaded.
|
void |
close() |
static JdbcDataset |
createDataset(JdbcDataset.DatabaseProvider databaseProvider,
JdbcConnectionFactory factory,
String tableNamePrefix,
AbstractPipeline pipeline)
Creates a persistent dataset stored in a database determined by the provided
JdbcDataset.DatabaseProvider. |
static JdbcDataset |
createDataset(JdbcDataset.DatabaseProvider databaseProvider,
JdbcConnectionFactory factory,
String tableNamePrefix,
DataReaderFactory dataReaderFactory)
Creates a persistent dataset stored in a database determined by the provided
JdbcDataset.DatabaseProvider. |
protected DataWriter |
createDataWriter()
Writes records to this dataset's cache after clearing it.
|
Column |
getColumn(int index) |
Column |
getColumn(String name) |
long |
getColumnCount() |
List<String> |
getColumnNames() |
List<Column> |
getColumns() |
String |
getDataTableName()
Gets the name of the data table in the database.
|
protected Column |
getOrCreateColumn(String name,
int index) |
Record |
getRecord(long index) |
long |
getRecordCount() |
RecordList |
getRecordList(long offset,
int count)
Get a subset of the records cached in this dataset.
|
String |
getStatsTableName()
Gets the name of the statistics table in the database.
|
boolean |
isAutoCloseConnection()
Returns whether the database connection will be automatically closed when this dataset is closed.
|
boolean |
isDropTablesOnClose()
Returns whether the database tables will be dropped when this dataset is closed.
|
static JdbcDataset |
openDataset(JdbcDataset.DatabaseProvider databaseProvider,
JdbcConnectionFactory factory,
String tableNamePrefix)
Loads an existing persistent dataset stored in a database determined by the provided
JdbcDataset.DatabaseProvider. |
JdbcDataset |
setAutoCloseConnection(boolean autoCloseConnection)
Sets whether to automatically close the database connection when this dataset is closed.
|
JdbcDataset |
setDropTablesOnClose(boolean dropTablesOnClose)
Sets whether to drop the database tables when this dataset is closed.
|
addField, afterRecordsLoaded, cancelLoad, createColumnsDataReader, createDataReader, createDataReader, finalize, forEach, fromRecord, getColumnStatsException, getColumnStatsReaderThreads, getDataLoadException, getJob, getJobExecutor, getMaxColumnStatsRecords, getMaxColumnsToAnalyze, getMaxRecordsToLoad, getPipeline, isCollectUniqueValues, isColumnStatsLoaded, isDataLoaded, isDataLoading, isDetectBigNumberValues, isDetectBooleanValues, isDetectNumericValues, isDetectTemporalValues, isDetectUuidValues, isInferStringTypes, isRecordsLoaded, iterator, load, load, load, setCollectUniqueValues, setColumnStatsLoaded, setColumnStatsReaderThreads, setDetectBigNumberValues, setDetectBooleanValues, setDetectNumericValues, setDetectTemporalValues, setDetectUuidValues, setInferStringTypes, setJobExecutor, setMaxColumnStatsRecords, setMaxColumnsToAnalyze, setPipeline, setRecordsLoaded, stream, toRecord, updateColumns, waitForColumnStatsToLoad, waitForColumnStatsToLoad, waitForRecordsToLoad, waitForRecordsToLoad, waitUntilJobFinishedassertValid, assertValid, clone, exception, exception, exception, getInternalId, getInternalName, resetInternalIdequals, getClass, hashCode, notify, notifyAll, wait, wait, waitspliteratorfromArrayValue, fromArrayValue, fromArrayValue, fromJson, fromJson, newInstanceFromRecord, newInstanceFromRecord, toArrayValue, toJson, toJson, toJson, toRecordnewInstanceFromJsonforEachGrandChildElement, fromXml, fromXml, fromXmlElement, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getChildElement, getChildElements, newInstanceFromXml, newInstanceFromXml, setAttribute, toXml, toXml, toXml, toXml, toXml, toXmlElement, writeXml, writeXmladdExceptionProperties, contributeExceptionProperties, contributeExceptionPropertiespublic static JdbcDataset createDataset(JdbcDataset.DatabaseProvider databaseProvider, JdbcConnectionFactory factory, String tableNamePrefix, AbstractPipeline pipeline)
JdbcDataset.DatabaseProvider.
The data and statistics tables will remain on the database even after the dataset is closed,
unless setDropTablesOnClose(boolean) is set to true.
databaseProvider - the database provider defining database-specific SQL syntaxfactory - the JDBC connection factory for creating database connectionstableNamePrefix - the prefix for the data and statistics table namespipeline - the pipeline to use for loading data into the datasetJdbcDataset instancepublic static JdbcDataset createDataset(JdbcDataset.DatabaseProvider databaseProvider, JdbcConnectionFactory factory, String tableNamePrefix, DataReaderFactory dataReaderFactory)
JdbcDataset.DatabaseProvider.
The data and statistics tables will remain on the database even after the dataset is closed,
unless setDropTablesOnClose(boolean) is set to true.
databaseProvider - the database provider defining database-specific SQL syntaxfactory - the JDBC connection factory for creating database connectionstableNamePrefix - the prefix for the data and statistics table namesdataReaderFactory - the factory for creating the data reader to populate the datasetJdbcDataset instancepublic static JdbcDataset openDataset(JdbcDataset.DatabaseProvider databaseProvider, JdbcConnectionFactory factory, String tableNamePrefix)
JdbcDataset.DatabaseProvider.
This method opens a dataset that was previously created with createDataset(com.northconcepts.datapipeline.foundations.pipeline.dataset.JdbcDataset.DatabaseProvider, com.northconcepts.datapipeline.jdbc.JdbcConnectionFactory, java.lang.String, com.northconcepts.datapipeline.foundations.pipeline.AbstractPipeline) and reads
the existing data and statistics from the database tables.
databaseProvider - the database provider defining database-specific SQL syntaxfactory - the JDBC connection factory for creating database connectionstableNamePrefix - the prefix for the data and statistics table namesJdbcDataset instance containing the existing datasetpublic String getDataTableName()
public String getStatsTableName()
public JdbcDataset setDropTablesOnClose(boolean dropTablesOnClose)
If true, both the data and statistics tables will be dropped from the database
when close() is called. If false (default), the tables will remain in the database.
dropTablesOnClose - true to drop tables on close, false otherwisepublic boolean isDropTablesOnClose()
true if tables will be dropped on close, false otherwisepublic JdbcDataset setAutoCloseConnection(boolean autoCloseConnection)
If true (default), the database connection will be closed when close() is called.
If false, the connection will remain open and must be closed manually.
autoCloseConnection - true to auto-close the connection, false otherwisepublic boolean isAutoCloseConnection()
true if the connection will be auto-closed, false otherwisepublic void close()
public long getRecordCount()
getRecordCount in class Datasetpublic RecordList getRecordList(long offset, int count)
DatasetgetRecordList in class Datasetpublic long getColumnCount()
getColumnCount in class Datasetpublic List<String> getColumnNames()
getColumnNames in class Datasetprotected Column getOrCreateColumn(String name, int index)
getOrCreateColumn in class Datasetpublic List<Column> getColumns()
getColumns in class Datasetprotected void beforeLoad()
DatasetbeforeLoad in class Datasetprotected void afterLoad()
Datasetprotected void afterColumnStatsLoaded()
DatasetafterColumnStatsLoaded in class Datasetprotected DataWriter createDataWriter()
DatasetcreateDataWriter in class Datasetpublic DataException addExceptionProperties(DataException exception)
FoundationObjectDataException. Since this method is called whenever an
exception is thrown, subclasses should override it to add their specific information.addExceptionProperties in interface DataExceptionContributoraddExceptionProperties in class FoundationObjectCopyright (c) 2006-2026 North Concepts Inc. All Rights Reserved.