After installing FairCom DB Standalone SQL Service, the next step is to make the data ready for SQL access. This step involves importing the data into the format FairCom DB uses for SQL tables. This process uses the ctsqlimp SQL import utility to import the data into a FairCom DB SQL database, which serves as the data dictionary for FairCom DB Standalone SQL Service.
This process does not affect data access from your FairCom DB Multi-User Standalone database and it does not modify your existing data files. This process does, however, require that your data files contain a FairCom DB File Structure (known as IFIL structures) and a FairCom DB File Schema (known as a Dynamic Object Definition Array or DODA) discussed in the Using Existing ISAM Data with FairCom DB SQL section in the FairCom DB SQL Operations Guide. You can determine if your data files have these necessary structures by executing the ctinfo utility included with the FairCom DB Standalone SQL Service package. Simply execute ctinfo over a copy of one of your application data files (typically data files will have a .dat file extension) and read the output from the utility. This utility only reads header information from the data file and reports what it finds. It will tell you if the necessary IFIL and DODA structures are present.
The Import Process
Before your files can be accessed through one of the SQL APIs, the data must be made ready using a simple import process. This import process reads the File (IFIL structures) and Field (Data Object Definition Array – DODA) schema information and creates the SQL dictionary.
- Shut down all instances of your FairCom DB application to ensure your application data files are all in a closed state.
Be sure the FairCom DB Standalone SQL Service is running (the service name is FairCom-SQL; the process name is faircom_sql_service.exe).
- Identify your database name. By default, FairCom DB Standalone SQL Service (faircom_sql_service.exe) creates a database called "ctreeSQL." This can be changed in the ctsrvr.cfg file located by default in the data directory. See the SQL_DATABASE keyword. Note you will need to stop and restart the faircom_sql_service* process after any changes to ctsrvr.cfg.
- Use the ctsqlimp utility to import your data into the database. A typical usage might look like this:
ctsqlimp.exe \mypath\myfile.dat –d ctreeSQL -u USERNAME -a PASSWORD
ctsqlimp - SQL Import Utility
The FairCom DB SQL import utility, ctsqlimp, utility “registers” or links existing c-tree files with a FairCom DB SQL database without modifying the table structure such that the files remain accessible from the original application and also accessible from FairCom DB SQL.
For more information about this utility, see ctsqlimp - SQL Import Utility.
Auto Import
FairCom DB has the ability to "Auto Import" a table into SQL at the time it is accessed. To use this feature, you will need to supply a SQL callback library providing the information needed to import the database, such as the database name, the table owner, and the table name. At runtime, when the SQL parser encounters an object not present as a table in the system tables, it calls the registered function and imports the database.
For more information about "Auto Import", see Auto Import Callback.