Cloudsync Commands Reference
Page 3 of 8

COPY PUBLICATION

Creates a file from which to create a target database. This statement can only be executed on a source database.

Syntax

COPY PUBLICATION PublicationName
[ ( ParameterName = value [, ParameterName = value ]* ) ]
TO FILE 'FileName'

PublicationName and ParameterName are SQL-J-style identifiers. (See the Cloudscape Reference Manual for more information on SQL-J identifiers.) PublicationName is schema-qualifiable and ParameterName is not schema-qualifiable.

You must have operating system write permission on the destination file. FileName is a string delimited by single quotes ('). FileName can use either a relative path (to the database's JVM's current working directory) or an absolute path, and uses operating system, not URL, syntax. If the specified file already exists, it is overwritten.

When copying a publication to a file, you can specify values for the parameters. Parameters not stated in the COPY PUBLICATION statement assume their default values. Parameter values are plugged into the WHERE clauses (defined at CREATE PUBLICATION time) to pick out the desired rows.

When a CREATE PUBLICATION statement is prepared, COPY PUBLICATION's ParameterName values and FileName can be "?" parameters that will be specified at run-time.

COPY PUBLICATION always occurs at isolation level 3 (SERIALIZABLE), even if the current transaction is at another isolation level.

To see the parameter values in an existing target:

  1. Get the publication ID by calling COM.cloudscape.database.PropertyInfo.getDatabaseProperty.
  2. Look at the row(s) in SYSCOLUMNS whose key is that publication ID.

For example, the following query at the target returns the target's parameter information:

SELECT * FROM SYS.SYSCOLUMNS
WHERE referenceid=PropertyInfo.getDatabaseProperty(
    'sysinfo.publicationID')

See CREATE PUBLICATION for details about publication contents.

Example

-- issued at source
COPY PUBLICATION toysales (salesRepID = 2)
    TO FILE 'toysalespub2.cpy'

-- in a prepared statement
COPY PUBLICATION toysales( salesRepID = ?)
TO FILE ?