ALTER DATABASE updates the database's Connection Properties.
SET DBID clause:
SET DATABASE NAME clause:
SET DEFAULT SERVER clause:
SET DEFAULT PORT clause:
ALTER DATABASE changes the database connection attributes, including the physical database name, the port, and (for Adabas databases) the dbid. ALTER DATABASE has two formats:
For Adabas only:
ALTER DATABASE <dbname> [set dbid=<number>] | [set defaultserver=<name> apply=(allusers, currentuser, nouser)] | [set defaultport=<port#>]
where
dbname = Name of the Database (example localhost, Sales, ...)
set dbid = Number from 1-255
set defaultserver = default server
apply = level of affected users
allusers = change apply to all who access this database (default values)
currentuser = changes only apply to the current (logged in) user
defaultonly = no changes (only applies to future users)
set defaultport = default port
For all other databases:
ALTER DATABASE <dbname> [set physicaldatabasename = <physical database property> | [set defaultserver=<name> apply=(allusers, currentuser, nouser)] | [set defaultport=<port#>]
where
dbname = Name of the Database (example localhost, Sales, ...)
set physicaldatabasename = physical database property
set defaultserver = default server
apply = level of affected users
allusers = change apply to all who access this database (default values)
currentuser = changes only apply to the current (logged in) user
defaultonly = no changes (only applies to future users)
set defaultport
= default port
Only administrators (members of the group CONNXCDDAdministrators) can use ALTER DATABASE.
Both the source database (dbname) and the target database (dbid or physicaldatabasename/defaultserver) must exist prior to issuing this command.
Every table mapped in the CDD in the source database must be in the target database.
Every shared source and target table mapped in the CDD must have identical structure.
defaultport cannot be the only attribute that changes.
Both the source and target databases must have the same type. You cannot use this command to change the fundamental database type (for example, no RMS to VSAM).
The ALTER DATABASE statement is not part of the ANSI Standard.
Examples
Change the dbid to 57
Alter Database EMPLOYEES set dbid=57
Change the default server to PRODUCTION, and change any users that are registered for EMPLOYEES to connect to the PRODUCTION server.
Alter Database EMPLOYEES set defaultserver=PRODUCTION apply=allusers
Change the default server to PRODUCTION, and change only the user that is logged in to point to PRODUCTION for their database connection to EMPLOYEES.
Alter Database EMPLOYEES set defaultserver=PRODUCTION apply=currentuser
Change the default server to PRODUCTION, but ensure this change does not affect users that are pointing to the prior default server.
Alter Database EMPLOYEES set defaultserver=PRODUCTION apply=defaultonly
Change the default port to 7505
Alter Database EMPLOYEES set defaultport=7505
Change the physical database name to cnxdir:connx_rdb_examples
Alter Database EMPLOYEES set physicaldatabasename = cnxdir:connx_rdb_examples