CONNECT

Connects to a database.

SYNTAX

database_name Name of the database you are connecting to.
user_ID Name of the user connecting to the database.
password Current password of user user_name.

DESCRIPTION

The CONNECT command establishes a connection to a database. The user name and password are case-sensitive, while the database name is not. Any user with CONNECT or higher security privileges can execute the CONNECT command.

Before you can connect to a database, the dmconfig.ini configuration file on your computer must contain a database configuration section for the database you want to connect to. The database configuration section should already exist if the database was created on your local computer (DBMaker will automatically create a database configuration section if one does not exist when you create your database). If the database was created on a remote computer, you will have to add the database configuration section yourself or ask your System Administrator to add it for you.

Use the CONNECT command to connect to a single-user database. This starts the database and establishes a connection. While you are connected to a single-user database, no other users may connect to that database.
Before you can connect to a single-user database, you must specify the database directory. Use the DB_DBDIR keyword to set the directory containing the database in the dmconfig.ini configuration file.

Use the CONNECT command to connect to a client/server database if the database server is running. If the database server is not running, you must start it yourself or ask your System Administrator to start it before you can connect.

Before you can connect to a client server database, you must specify the IP address of the host computer running the DBMaker server and the port number of the database. Use the DB_SVADR and DB_PTNUM keywords to set the IP address and the port number in the dmconfig.ini configuration file. If you do not know the IP address and port number for the database you want to connect to, you should ask your System Administrator. You may also substitute a host name in place of an IP address when using the DB_SVADR keyword.

DBMaker will try to connect to a client/server database until the connection timeout period expires. The connection timeout period is specified by the DB_CTIMO keyword in the dmconfig.ini configuration file. The DB_CTIMO keyword does not apply to single-user databases. You may be unable to connect to a database if the database server is not running, or if an incorrect IP address or port number is specified in the dmconfig.ini configuration file.

The user name and password are not optional. However, there is one exception: if your password is NULL, you must omit the password. You may also omit the user name and password from the CONNECT command if you use the DB_USRID and DB_PASWD keywords in the dmconfig.ini configuration file. The DB_USRID keyword allows you to specify a default user name and the DB_PASWD keyword allows you to specify a default password. You cannot specify one parameter on the command line and the other in the configuration file; DBMaker will always take the user name and password from the same location. DBMaker will ignore the values specified by the DB_USRID and DB_PASWD keywords if you provide a username and password in the CONNECT command.

EXAMPLES

The following example connects user jenny with password grala833 to the single-user Tutor1 database.

CONNECT TO Tutor1 jenny grala833

Your dmconfig.ini configuration file should provide a value for the DB_DBDIR keyword in the Tutor1 configuration section, as illustrated below.

[TUTOR1]
DB_DBDIR = C:\DBMAKER\DATABASE\TUTOR1

The following example connects user amanda with password grixa944 to the multi-user Tutor2 database.

CONNECT TO Tutor2 amanda grala833

Your dmconfig.ini configuration file should provide a value for the DB_SVADR and DB_PTNUM keywords in the Tutor2 configuration section, as illustrated below.

[TUTOR2]
DB_SVADR = 192.168.8.127
DB_PTNUM = 35400

Alternatively, you can use a host name for the DB_SVADR keyword instead of an IP address, as shown below.

[TUTOR2]
DB_SVADR = mercury.syscom.com
DB_PTNUM = 35400

The following example connects user vivian with password shuka828 to the multi-user Tutor2 database. The user name and password are not provided in the command since they are specified by the DB_USRID and DB_PASWD keywords in the dmconfig.ini configuration section. If you provide a user name and password in the command, DBMaker ignores the values specified by the DB_USRID and DB_PASWD keywords.

CONNECT TO Tutor2

Your dmconfig.ini configuration file should provide values for the DB_SVADR, DB_PTNUM, DB_USRID, and DB_PASWD keywords in the Tutor2 configuration section, as illustrated below.

[TUTOR2]
DB_SVADR = 192.168.8.127
DB_PTNUM = 35400
DB_USRID = vivian
DB_PASWD = shuka828

As in the previous example, you can also substitute a host name for the IP address.

RELATED COMMANDS

< COMMIT WORK | Contents | CREATE COMMAND >

Copyright 2002 SYSCOM Computer Engineering Co. All rights reserved.