Connecting Manually
The manual connection process for any driver consists of three steps:
- Creating an intermediate file.
- Adding a filelist entry.
- Generating a FD file.
Creating an Intermediate File
To manually connect to existing data, you first need to create an intermediate file.
For SQL drivers, this intermediate file should at least set the intermediate file keywords DRIVER_NAME and SERVER_NAME. Normally, you would also set the DATABASE_NAME and possibly the SCHEMA_NAME keyword. The table to connect to must have at least one unique index defined.
For Pervasive.SQL, an intermediate file is not required when running in non-database mode. When running in database mode, intermediate files are required to store the URI information of the database. If you want to connect to a table when using non-database mode, an intermediate file is required when you want to set up a relationship for the table.
The intermediate file for Pervasive.SQL should contain at least the DRIVER_NAME keyword. If using database mode, it should also contain the URI keyword.
SQL Server
For example, if we want to connect to the table Department, owned by dbo in the database MyDB, on server MySrvr, using Windows NT authentication, we would create an intermediate file, called dept.int, with the following content:
DRIVER_NAME MSSQLDRV
SERVER_NAME SERVER=MySrvr;Trusted_Connection=yes;DATABASE=MyDB
DATABASE_NAME Department
SCHEMA_NAME dbo
ODBC
For example, if you want to connect to the table Department, in the data source Company, we would create an intermediate file, called dept.int, with the following content:
DRIVER_NAME ODBC_DRV
SERVER_NAME DSN=Company
DATABASE_NAME Department
DB2
For example, if we want to connect to the table Department in the schema CompSchema in the database Company, we would create an intermediate file, called dept.int, with the following content:
DRIVER_NAME DB2_DRV
SERVER_NAME DSN=Company
DATABASE_NAME Department
SCHEMA_NAME CompSchema
Pervasive.SQL
For example, if we want to connect in database mode to the table Department in the database MyDB on server MyServer as user “ed” using password “secret”, we would create an intermediate file, called dept.int, with the following content:
DRIVER_NAME DFBTRDRV
URI btrv://ed@MyServer/MyDB?table=Department&pwd=secret
If you want to connect in non-database mode to the table Department, we would create an intermediate file, called dept.int, with the following content:
DRIVER_NAME DFBTRDRV
DDF_NAME Department
Creating a Filelist Entry
The next step is to place a reference to the created intermediate file in the filelist:
- Use Database Builder.
- Select the appropriate workspace.
- From the "Filelist" menu, choose "New entry…".
For the new entry, you should set the root name to the name of the intermediate file you just created (dept.int). The user and logical name can be set to your specifications. Typically, in the above example, they would be set to “Departments in the company” and “dept” respectively.
Generating an FD File
The last step is to generate a FD file for the new filelist entry. The DataFlex compiler uses FD files to import table definitions. Use Database Builder to generate the FD.