Please enable JavaScript to view this site.

R:BASE 11 Help

Navigation: Command Index > C

CONNECT (Short Name: CONN)

Scroll Prev Top Next More

Use the CONNECT command to open a database.

 

CONNECT

 

Options

 

dbspec

Opens a specified database.

 

IDENTIFIED BY

Specifies the user identifier. If left blank, R:BASE prompts you for the user identifier. R:BASE does not display it as you enter the text.

 

owner

Specifies the database owner name.

 

password

Optional; verifies the correct user identifier of the current user of the database.

 

READ

Opens a database as read-only. When you open a database as read-only, you cannot modify the data or database structure. All users must connect to the database in read mode if it is used.

 

userid

Specifies the user identifier. When access rights have been assigned using the GRANT command, you must enter an appropriate user identifier with the CONNECT command unless permission has been granted to PUBLIC.

 

WRITE

Opens a database in write/read mode. When you open a database in write/read mode, you can view and modify the database. This mode is the default when you use the CONNECT command without options.

 

About the CONNECT Command

 

R:BASE opens a database according to the current settings for the following SET commands: FASTFK, FASTLOCK, MULTI, ROWLOCKS, TRANSACTIONS, and STATICDB. Only one database can be open at a time.

 

You must open a database to use it; however, a database cannot be open when you copy, rename, or erase the database files.

 

When you use the CONNECT command without any of its options, R:BASE displays a list of the databases in the current directory. To open a database, highlight the database name and press [Enter]. This differs from older versions of R:BASE which required you to list a database in the connection command.

 

To open a database that is not in the current directory, add the drive and directory before you enter the database name, or use the CHDIR command before using CONNECT.

 

Database Access Rights with CONNECT

 

When you use the IDENTIFIED BY option, R:BASE identifies your level of access to the database. Only the last user identifier specified is in effect. If your user identifier contains spaces, enclose it in quotation marks when you enter it.

 

Closing a Database

 

R:BASE closes a database when you:

 

Open another database.

Issue a DISCONNECT command.

Issue an EXIT command.

Define a new database.

 

Updating Database Timestamps

 

When a database is created or opened, a timestamp is encoded in each of the four database files, enabling the database files to be stored in separate directories apart from one another. To ensure that the correct database files are accessed, R:BASE evaluates the timestamp values of the files as it searches for them on the path statement. R:BASE tries to connect to File 1 first, then it searches the path for the other database files.

 

Updating the encoded timestamp values in the four database files so that they all have the same timestamp values might be necessary if R:BASE is halted or if your computer or operating system crashes. When you try to connect to a database that is out of synchronization, R:BASE displays an error message. The RBSYNC command must be run.

 

Examples

 

The following command opens the letters database located on drive C: in the TOOLS/WP directory. R:BASE opens letters for reading and writing.

 

CONNECT c:\tools\wp\letters

 

The following command opens the mydata database with user two as the user identifier. The user identifier is enclosed in quotation marks because it contains a space.

 

CONNECT mydata IDENTIFIED BY 'user two'

 

The following example displays all databases in the current directory and allows you to select the database you wish to connect to.

 

CONNECT