Class Export


public class Export extends ExportAbstract
This class provides ways to export data from a table or a view into a file. Export functions provided in this class are called through Systement Procedures.
  • Field Details

    • outputFileName

      private String outputFileName
    • lobsFileName

      private String lobsFileName
  • Constructor Details

  • Method Details

    • doExport

      private void doExport() throws SQLException
      Throws:
      SQLException
    • setLobsExtFileName

      private void setLobsExtFileName(String lobsFileName) throws SQLException
      Set the file name to which larg object data has to be exported, and also set flag to indicate that large objects are exported to a different file.
      Parameters:
      lobsFileName - the file to to which lob data has to be exported.
      Throws:
      SQLException - if file name is null.
    • lobsFileExists

      private boolean lobsFileExists(String fileName) throws SQLException
      Checks whether the lobs file exists .
      Parameters:
      fileName - the file to to which lob data has to be exported.
      Throws:
      SQLException - if file name is null.
    • dataFileExists

      private boolean dataFileExists(String fileName) throws SQLException
      Checks whether the data file exists .
      Parameters:
      fileName - the file to to which lob data has to be exported.
      Throws:
      SQLException - if file name is null.
    • fileExists

      private final boolean fileExists(File file)
      Checks if the specified file exists.
      Parameters:
      file - the file to check
      Returns:
      true if the file exists, false if not.
      Throws:
      SecurityException - if the required privileges are missing
    • exportTable

      public static void exportTable(Connection con, String schemaName, String tableName, String outputFileName, String columnDelimeter, String characterDelimeter, String codeset) throws SQLException
      SYSCS_EXPORT_TABLE system Procedure from ij or from a Java application invokes this method to perform export of a table data to a file.
      Parameters:
      con - The Derby database connection URL for the database containing the table
      schemaName - schema name of the table data is being exported from
      tableName - Name of the Table from which data has to be exported.
      outputFileName - Name of the file to which data has to be exported.
      columnDelimeter - Delimiter that seperates columns in the output file
      characterDelimeter - Delimiter that is used to quoate non-numeric types
      codeset - Codeset that should be used to write the data to the file
      Throws:
      SQLException - on errors
    • exportTable

      public static void exportTable(Connection con, String schemaName, String tableName, String outputFileName, String columnDelimeter, String characterDelimeter, String codeset, String lobsFileName) throws SQLException
      SYSCS_EXPORT_TABLE_LOBS_TO_EXTFILE system procedure from ij or from a Java application invokes this method to perform export of a table data to a file. Large object data is exported to a different file and the reference to it is stored in the main output file.
      Parameters:
      con - The Derby database connection URL for the database containing the table
      schemaName - schema name of the table data is being exported from
      tableName - Name of the Table from which data has to be exported.
      outputFileName - Name of the file to which data has to be exported.
      columnDelimeter - Delimiter that seperates columns in the output file.
      characterDelimeter - Delimiter that is used to quote non-numeric types.
      codeset - Codeset that should be used to write the data to the file/
      lobsFileName - Name of the file to which large object data has to be exported.
      Throws:
      SQLException - on errors
    • exportQuery

      public static void exportQuery(Connection con, String selectStatement, String outputFileName, String columnDelimeter, String characterDelimeter, String codeset) throws SQLException
      SYSCS_EXPORT_QUERY system Procedure from ij or from a Java application invokes this method to perform export of the data retrieved by select statement to a file.
      Parameters:
      con - The Derby database connection URL for the database containing the table
      selectStatement - select query that is used to export the data
      outputFileName - Name of the file to which data has to be exported.
      columnDelimeter - Delimiter that seperates columns in the output file
      characterDelimeter - Delimiter that is used to quiote non-numeric types
      codeset - Codeset that should be used to write the data to the file
      Throws:
      SQLException - on errors
    • exportQuery

      public static void exportQuery(Connection con, String selectStatement, String outputFileName, String columnDelimeter, String characterDelimeter, String codeset, String lobsFileName) throws SQLException
      SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE system Procedure from ij or from a Java application invokes this method to perform export of the data retrieved by select statement to a file. Large object data is exported to a different file and the reference to it is stored in the main output file.
      Parameters:
      con - The Derby database connection URL for the database containing the table
      selectStatement - select query that is used to export the data
      outputFileName - Name of the file to which data has to be exported.
      columnDelimeter - Delimiter that seperates columns in the output file
      characterDelimeter - Delimiter that is used to quote non-numeric types
      codeset - Codeset that should be used to write the data to the file
      lobsFileName - Name of the file to which large object data has to be exported.
      Throws:
      SQLException - on errors
    • getExportWriteData

      protected ExportWriteDataAbstract getExportWriteData() throws Exception
      For internal use only
      Specified by:
      getExportWriteData in class ExportAbstract
      Throws:
      Exception - if there is an error