Top Description Fields Constructors Methods
org.apache.derby.impl.load

public Class Export

extends ExportAbstract
Class Inheritance
Imports
java.sql.Connection, .SQLException, java.io.IOException, .File, org.apache.derby.shared.common.error.PublicAPI, .StandardException, org.apache.derby.shared.common.reference.SQLState, org.apache.derby.iapi.services.io.FileUtil, org.apache.derby.iapi.security.Securable, .SecurityUtil

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 Summary

Modifier and TypeField and Description
private String
private String
Inherited from org.apache.derby.impl.load.ExportAbstract:
concontrolFileReaderentityNameexportResultSetForObjectexportWriteDatalobsInExtFileschemaNameselectStatement

Constructor Summary

AccessConstructor and Description
private
Export(Connection con, String schemaName, String tableName, String selectStatement, String outputFileName, String characterDelimeter, String columnDelimeter, String codeset)

Method Summary

Modifier and TypeMethod and Description
private boolean
dataFileExists(String
the file to to which lob data has to be exported.
fileName
)

Checks whether the data file exists .

private void
public static void
exportQuery(Connection
The Derby database connection URL for the database containing the table
con
,
String
select query that is used to export the data
selectStatement
,
String
Name of the file to which data has to be exported.
outputFileName
,
String
Delimiter that seperates columns in the output file
columnDelimeter
,
String
Delimiter that is used to quiote non-numeric types
characterDelimeter
,
String
Codeset that should be used to write the data to the file
codeset
)

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.

public static void
exportQuery(Connection
The Derby database connection URL for the database containing the table
con
,
String
select query that is used to export the data
selectStatement
,
String
Name of the file to which data has to be exported.
outputFileName
,
String
Delimiter that seperates columns in the output file
columnDelimeter
,
String
Delimiter that is used to quote non-numeric types
characterDelimeter
,
String
Codeset that should be used to write the data to the file
codeset
,
String
Name of the file to which large object data has to be exported.
lobsFileName
)

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.

public static void
exportTable(Connection
The Derby database connection URL for the database containing the table
con
,
String
schema name of the table data is being exported from
schemaName
,
String
Name of the Table from which data has to be exported.
tableName
,
String
Name of the file to which data has to be exported.
outputFileName
,
String
Delimiter that seperates columns in the output file
columnDelimeter
,
String
Delimiter that is used to quoate non-numeric types
characterDelimeter
,
String
Codeset that should be used to write the data to the file
codeset
)

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.

public static void
exportTable(Connection
The Derby database connection URL for the database containing the table
con
,
String
schema name of the table data is being exported from
schemaName
,
String
Name of the Table from which data has to be exported.
tableName
,
String
Name of the file to which data has to be exported.
outputFileName
,
String
Delimiter that seperates columns in the output file.
columnDelimeter
,
String
Delimiter that is used to quote non-numeric types.
characterDelimeter
,
String
Codeset that should be used to write the data to the file/
codeset
,
String
Name of the file to which large object data has to be exported.
lobsFileName
)

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.

private final boolean

Returns:

true if the file exists, false if not.
fileExists
(final File
the file to check
file
)

Checks if the specified file exists.

protected ExportWriteDataAbstract
private boolean
lobsFileExists(String
the file to to which lob data has to be exported.
fileName
)

Checks whether the lobs file exists .

private void
setLobsExtFileName(String
the file to to which lob data has to be exported.
lobsFileName
)

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.

Inherited from org.apache.derby.impl.load.ExportAbstract:
doAllTheWorkgetControlFileReaderresultSetForEntitystringifyObject

Field Detail

lobsFileNameback to summary
private String lobsFileName
outputFileNameback to summary
private String outputFileName

Constructor Detail

Exportback to summary
private Export(Connection con, String schemaName, String tableName, String selectStatement, String outputFileName, String characterDelimeter, String columnDelimeter, String codeset) throws SQLException

Method Detail

dataFileExistsback to summary
private boolean dataFileExists(String fileName) throws SQLException

Checks whether the data file exists .

Parameters
fileName:String

the file to to which lob data has to be exported.

Exceptions
SQLException:
if file name is null.
doExportback to summary
private void doExport() throws SQLException
exportQueryback to summary
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:Connection

The Derby database connection URL for the database containing the table

selectStatement:String

select query that is used to export the data

outputFileName:String

Name of the file to which data has to be exported.

columnDelimeter:String

Delimiter that seperates columns in the output file

characterDelimeter:String

Delimiter that is used to quiote non-numeric types

codeset:String

Codeset that should be used to write the data to the file

Exceptions
SQLException:
on errors
exportQueryback to summary
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:Connection

The Derby database connection URL for the database containing the table

selectStatement:String

select query that is used to export the data

outputFileName:String

Name of the file to which data has to be exported.

columnDelimeter:String

Delimiter that seperates columns in the output file

characterDelimeter:String

Delimiter that is used to quote non-numeric types

codeset:String

Codeset that should be used to write the data to the file

lobsFileName:String

Name of the file to which large object data has to be exported.

Exceptions
SQLException:
on errors
exportTableback to summary
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:Connection

The Derby database connection URL for the database containing the table

schemaName:String

schema name of the table data is being exported from

tableName:String

Name of the Table from which data has to be exported.

outputFileName:String

Name of the file to which data has to be exported.

columnDelimeter:String

Delimiter that seperates columns in the output file

characterDelimeter:String

Delimiter that is used to quoate non-numeric types

codeset:String

Codeset that should be used to write the data to the file

Exceptions
SQLException:
on errors
exportTableback to summary
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:Connection

The Derby database connection URL for the database containing the table

schemaName:String

schema name of the table data is being exported from

tableName:String

Name of the Table from which data has to be exported.

outputFileName:String

Name of the file to which data has to be exported.

columnDelimeter:String

Delimiter that seperates columns in the output file.

characterDelimeter:String

Delimiter that is used to quote non-numeric types.

codeset:String

Codeset that should be used to write the data to the file/

lobsFileName:String

Name of the file to which large object data has to be exported.

Exceptions
SQLException:
on errors
fileExistsback to summary
private final boolean fileExists(final File file)

Checks if the specified file exists.

Parameters
file:File

the file to check

Returns:boolean

true if the file exists, false if not.

getExportWriteDataback to summary
protected ExportWriteDataAbstract getExportWriteData() throws Exception

Implements abstract org.apache.derby.impl.load.ExportAbstract.getExportWriteData.

For internal use only

Exceptions
Exception:
if there is an error
lobsFileExistsback to summary
private boolean lobsFileExists(String fileName) throws SQLException

Checks whether the lobs file exists .

Parameters
fileName:String

the file to to which lob data has to be exported.

Exceptions
SQLException:
if file name is null.
setLobsExtFileNameback to summary
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:String

the file to to which lob data has to be exported.

Exceptions
SQLException:
if file name is null.