CREATE LINK

Creates a new link to a remote database.

SYNTAX

link_name Name of the table you want to create to a remote address.
remote_db_name Name of the remote database you want to connect to.
user_name Name of a user in the remote database with CONNECT or higher security privileges.
password Password of the user in the remote database.

DESCRIPTION

The CREATE DATABASE LINK command creates a new public or private link to a remote database. Database links allow you to access objects in remote databases the same way you access objects in your local database. To execute the CREATE DATABASE LINK command to create a public link to a database, you must have DBA or SYSADM security privileges. To execute the CREATE DATABASE LINK command to create a private link to a database, you must have CONNECT or higher security privileges.

A database link creates a connection to a remote database, providing access to remote data from your local database. Although you can directly identify remote databases, links provide additional benefits since they also contain security information. This allows you to connect to a remote database with a different user name than you are using in the local database, or connect to a remote database that you do not have an account in using a public link.

When you create a database link, you must provide the link name and the remote database name. In addition, the dmconfig.ini configuration file for both the local and remote database must contain a database configuration section for the opposite database. This database configuration section must contain the IP address of the opposite database server, and the port number for the opposite database. You can specify the IP address using the DB_SVADR keyword, and the port number using the DB_PTNUM keyword.

The PUBLIC/PRIVATE keywords are optional. These keywords specify the type of database link you want to create: public or private. Public links are available to all users in a database, while private links are available only to the user that creates them. Only users with DBA or SYSADM security privileges can create a public database link, while any user can create a private database link. If both a public and private link exist with the same name, DBMaker will use the private link instead of the public link. If you do not specify the type of link you want to create, DBMaker will create a private link by default.

The IDENTIFIED BY keywords are optional. This keyword specifies the user name (and password) you want to use when you connect to the remote database. The user name you provide must be an existing user in the remote database with CONNECT or higher security privileges. When you use the link to connect to the remote database, the operations you can perform will depend on the security and object privileges granted to that user. If you do not specify the user name to use when connecting to the remote database, DBMaker will use your current user name in the local database by default.

Link names have a maximum length of eighteen characters, and may contain numbers, letters, the underscore character, and the symbols $ and #. The first character may not be a number.

EXAMPLES

The following example creates a public database link named FieldLink to the remote FieldOffice database. The user creating the link must have DBA or SYSADM security privileges in the local database since the link is public, and must have the same user name in both the local and remote databases since no user name in the remote database is provided. Using this link will automatically connect you to the remote database with same user name as the link creator, and provide you with the security and object privileges granted to this user in the remote database.

CREATE PUBLIC LINK FieldLink CONNECT TO FieldOffice

The following example creates a public database link named FieldLink to the remote FieldOffice database. The user creating the link must have DBA or SYSADM security privileges in the local database since the link is public. Using this link will automatically connect you to the remote database with user name LinkUser and password dil3ryx9, and provide you with the security and object privileges granted to this user.

CREATE PUBLIC LINK FieldLink CONNECT TO FieldOffice
IDENTIFIED BY LinkUser dil3ryx9

The following example creates a private database link named FieldLink to the remote FieldOffice database. The user creating the link must the same user name in both the local and remote databases since no user name in the remote database is provided. Using this link will automatically connect you to the remote database with same user name you are using in the local database, and will use the security and object privileges granted to your account in the remote database. If there is a public link with the same name, the private link will be used instead.

CREATE PRIVATE LINK FieldLink CONNECT TO FieldOffice

The following example creates a private database link named FieldLink to the remote FieldOffice database. Using this link will automatically connect you to the remote database with user name Vivian and password a23456, and provide you with the security and object privileges granted to this user. This is useful if you have a different user name in the local and remote databases. If there is a public link with the same name, the private link will be used instead.

CREATE PRIVATE LINK FieldLink CONNECT TO FieldOffice
IDENTIFIED BY Vivian a23456

RELATED COMMANDS

< CREATE INDEX | Contents | CREATE REPLICATION >

Copyright 2002 SYSCOM Computer Engineering Co. All rights reserved.