CREATE DATABASE LINK
CREATE DATABASE LINK#
Syntax#
create_database_link ::=
Prerequisites#
Only the SYS user or the user granted the CREATE DATABASE LINK system privilege can create a database link object.
Description#
The user can create a database link object with the CREATE DATABASE LINK statement. A database link object can have only one remote server as its target.
PUBLIC|PRIVATE#
Specifies the PUBLIC|PRIVATE attribute of the database link object to be created. If set to PUBLIC, all users have access to the created database link object; If set to PRIVATE, only the user who created the database link object and the SYS user have access to it. On omission, the database object link is created as PUBLIC.
dblink_name#
Specifies the name of the database link object to be created. Refer to Chapter 1: "Rules for Object Name" in SQL Reference for more information on specifying names.
user_id/password#
Specifies the user name and user password of the database of the remote server to be connected. The user specified for this clause must be granted access privileges on the target object of the remote server accessed through the database link. If not, a privilege-related error will be raised.
Since the user name and password are saved in upper case by default, it is necessary to encase case-sensitive letters and special characters in quotation marks(").
target_name#
Specifies the name of a server among the remote servers defined in the TARGETS property in the AltiLinker properties file.
For more detailed information on how to specify the TARGETS property in the AltiLinker properties file, please refer to "Configuration of the AltiLinker Properties File" of Chapter 3.
Example#
<Create 1> Create a database link which connects to the remote database server specified 'AltibaseHDB' in the AltiLinker properties file, with the user name and user password: applys/applys. Create the database link object, 'link1', which only the creator can access.
CREATE PRIVATE DATABASE LINK link1
CONNECT TO applys IDENTIFIED BY applys
USING Altibase;
<Query 2> Create a database link which connects to the remote database server specified 'AltibaseHDB' in the AltiLinker properties file, with the user name and user password: applys/applys. Create the database link object, 'link2', which all users of the system can access. However, the user name and password are in lower case.
CREATE PUBLIC DATABASE LINK link2
CONNECT TO "applys" IDENTIFIED by "applys"
USING Altibase;
or
CREATE DATABASE LINK link2
CONNECT TO "applys" IDENTIFIED by "applys"
USING Altibase;