background image
<< slavePort=portValue attribute | stopMaster=true attribute >>

startSlave=true attribute

<< slavePort=portValue attribute | stopMaster=true attribute >>
Derby Reference Manual
346
If the master database is already booted and any unlogged operations are running when
the user specifies startMaster=true, the attempt to start the master fails and an error
message appears.
For more information on replication, see the other topics under "Replicating databases" in
the Derby Server and Administration Guide.
Combining with other attributes
You must specify a database name in the connection URL, either in the subprotocol or by
using the
databaseName=nameofDatabase
attribute.
You must specify this attribute in conjunction with the
slaveHost=hostname
attribute. You
may also specify this attribute in conjunction with the
slavePort=portValue
attribute. If you
do not specify the slavePort=portValue attribute, the default port value is 4851.
If authentication is turned on, you must also specify this attribute in conjunction with the
user=userName
and
password=userPassword
attributes. If both authentication and SQL
authorization are turned on, the user must be the database owner.
You may not specify this attribute in conjunction with any attributes not mentioned in this
section.
Examples
-- start master using database name in subprotocol, default slave
-- port, authorization
jdbc:derby:myDB;startMaster=true;slaveHost=elsewhere;user=mary;
password=little88lamb
-- start master using databaseName attribute, non-default slave
-- port, no security
jdbc:derby:;databaseName=myDB;startMaster=true;slaveHost=elsewhere;
slavePort=4852
startSlave=true attribute
Function
Starts replication of a database in slave mode. Before you specify this attribute, you must
cleanly shut down the database on the master system and then perform a file system
copy of the database to the slave system.
The startSlave=true attribute does the following:
1. Partially boots the specified database
2. Starts to listen on the specified port and accepts a connection from the master
3. Hangs until the master has connected to it
4. Reports the startup status to the caller (whether it has started, and if not, why not)
5. Continually receives chunks of the transaction log from the master and applies the
operations in the transaction log to the slave database
If replication is started successfully, an exception with the error code XRE08 is thrown.
Hence, the startSlave=true attribute does not return a valid connection.
For more information, see the topics under "Replicating databases" in the Derby Server
and Administration Guide
.
Combining with other attributes
You must specify a database name in the connection URL, either in the subprotocol or by
using the
databaseName=nameofDatabase
attribute.