Use the SCONNECT command to connect R:BASE to a data source.
Options
datasource
Specifies the name of the foreign data source that contains the table you want.
IDENTIFIED BY userid
Specifies your user account name for the foreign data source. You can use '' (two single quotes) in this position if there is no User ID.
password
Specifies your password for the foreign data source. You can use '' (two single quotes) in this position if there is no password.
About the SCONNECT Command
If you omit the datasource option, a dialog box opens, listing data sources from which to choose and continues with prompts for username and password.
About the DSN-Less Connection
A data source name (DSN) is a data structure that contains the information about a specific database that an Open Database Connectivity (ODBC) driver needs in order to connect to it. Included in the DSN, which resides either in the registry or as a separate text file, is information such as the name, directory and driver of the database, and, depending on the type of DSN, the ID and password of the user. The developer creates a separate DSN for each database. To connect to a particular database, the developer specifies its DSN within a program. In contrast, DSN-less connections require that all the necessary information be specified within the command. DSN-Less connection requires no server setup, just a carefully constructed connection string.
There are three kinds of DSN: user DSNs (sometimes called machine DSNs); system DSNs; and file DSNs. User and system DSNs are specific to a particular computer, and store DSN information in the registry. A user DSN allows database access for a single user on a single computer, and a system DSN for any user of a particular computer. A file DSN contains the relevant information within a text file with a .DSN file extension, and can be shared by users of different computers who have the same drivers installed.
DSN-less connections demand that you know the name of the file (i.e. file based databases like R:BASE) or the address of the data server (SQLServer for example).
Armed with appropriate information you could open a data source without a DSN!
Normally on the SCONNECT command you specify the DSN you want to use. ODBC looks up this DSN and determines the driver to use and what connection it needs. In this version we let you specify the ODBC driver instead of an DSN. This is done as follows:
Assume you have a R:BASE database called RRBYW8 located in a folder called D:\71D. To access this database you need an R:BASE 7.0 or Oterro 3.0 ODBC driver installed. For the SCONNECT command use this:
Note the initial semi-colon. This is the flag that you are not specifying a DSN. The item after the 'driver' is the actual name of the driver as defined in ODBC. Make sure you spell and space this exactly as it is defined in ODBC Data Source Administrator Drivers. The database and the exact path of the database is specified in the 'dbq' part of the string. The entire string must be surrounded by your database QUOTE character. Single quotes are used in the example above.
Example 03: (To use an Access database in "dsnless" mode):
SCONNECT ';Driver={Microsoft Access Driver (*.mdb)};DBQ=c:\Documents and Settings\Administrator\My Documents\db1.mdb;'
This example uses a database called db1.mdb in the "My Documents" folder. The connection can specify additional items like user id with the "UID=" parameter and a password with the "PWD=" parameter.
In this one note the server and database within the server get specified along with the uid and pwd.
Use SATTACH command to attach table(s).
With a connection like this you can use a linked R:BASE database without a pre-defined DSN. A table attached using such a connection remembers all this for later "DSN-less" access.
Notes:
To disconnect the DSN-less connection, use the exact same syntax using SDISCONNECT command.