Command-line Usage

As of version 1.15 of the DBCopy Plugin, a new command-line interface is available for copying tables. This can be useful for scripts in cases where copying is to be done in an automated way without a user present. Aliases that are configured in the SQuirreL SQL Client can be referenced using command-line parameters. This alias re-use keeps the amount of configuration to a minimum.

There is a super-jar available for download here:
http://repo1.maven.org/maven2/net/sf/squirrel-sql/cli/dbcopy-cli/1.0.2/dbcopy-cli-1.0.2.jar

Once the jar file is downloaded, it can be run with this command: java -jar dbcopy-cli-1.0.2.jar This will display the following usage:

    usage: DBCopyCLI --dest-alias  --dest-catalog  | --dest-schema
             --source-alias  --source-catalog  |
           --source-schema   --table-list  | --table-pattern
        --dest-alias        The name of the destination alias to copy
                                 tables to
        --dest-catalog      The destination catalog to copy tables into
        --dest-schema       The destination schema to copy tables into
        --source-alias      The name of the source alias to copy tables
                                 from
        --source-catalog    The source catalog to copy tables from
        --source-schema     The source schema to copy tables from
        --table-list        A comma-delimited list of tables to copy
        --table-pattern     A regexp pattern to match source table names

Examples:

To copy the tables employee, customer and address from an alias called "Derby (dbcopysrc)" to a database with alias "DB2 (DBCPDST)", issue the following command with a comma-delimited list of tables:

    java -jar dbcopy-cli-1.0.2.jar --source-alias "Derby (dbcopysrc)"
    					--dest-alias "DB2 (DBCPDST)"
    					--source-catalog ""
    					--source-schema "DBCOPY"
    					--dest-catalog ""
    					--dest-schema "DBCPDST"
    					--table-list employee,employer,customer,address

To copy all tables matching the pattern "emp*", use the --table-pattern argument instead of the --table-list (wildcard is specified as "%", as it is in standard SQL) :

    java -jar dbcopy-cli-1.0.2.jar --source-alias "Derby (dbcopysrc)"
    					--dest-alias "DB2 (DBCPDST)"
    					--source-catalog ""
    					--source-schema "DBCOPY"
    					--dest-catalog ""
    					--dest-schema "DBCPDST"
    					--table-pattern "emp%"