Setting Options Programmatically for the Text File Driver
Option | Description | Method |
---|---|---|
Data Source Name | A name that identifies the data source, such as Payroll or Personnel. | To set this option dynamically, use the DSN keyword in a call to SQLConfigDataSource. |
Define Format | Displays the Define Text Format dialog box and enables you to specify the schema for individual tables in the data source directory. | This option cannot be set dynamically by a call to SQLConfigDataSource. |
Description | An optional description of the data in the data source; for example, "Hire date, salary history, and current review of all employees." | To set this option dynamically, use the DESCRIPTION keyword in a call to SQLConfigDataSource. |
Directory | Selects the targeted directory. | To set this option dynamically, use the DEFAULTDIR keyword in a call to SQLConfigDataSource. |
Extensions List | Lists the file name extensions of the text files on the data source. When the Text driver is used, a file with no extension is created when the CREATE TABLE statement is executed with a name that has no extension. Other drivers create a file with a default extension when no extension is provided. To create a file with a .txt extension, the extension must be included in the name. To display files without extensions in the Define Text Format dialog box, "*." must be added to the Extensions List. | To set this option dynamically, use the EXTENSIONS keyword in a call to SQLConfigDataSource. |
Read Only | Designates the database as read-only. | To set this option dynamically, use the READONLY keyword in a call to SQLConfigDataSource. |
Rows to Scan | The number of rows to scan to determine the data type of each column. The data type is determined given the maximum number of kinds of data found. If data is encountered that does not match the data type guessed for the column, the data type will be returned as a NULL value. For the Text driver, you may enter a number from 1 to 32767 for the number of rows to scan; however, the value will always default to 25. (A number outside the limit will return an error.) |
To set this option dynamically, use the MAXSCANROWS keyword in a call to SQLConfigDataSource. |
Select Directory | Displays a dialog box where you can select a directory containing the files you want to access. When defining a data source directory specify the directory where your most commonly used files are located. The ODBC driver uses this directory as the default directory. Copy other files into this directory if they are used frequently. Alternatively, you can qualify file names in a SELECT statement with the directory name: SELECT * FROM C:\MYDIR\EMP Or, you can specify a new default directory by using the SQLSetConnectOption function with the SQL_CURRENT_QUALIFIER option. |
To set this option dynamically, use the DEFAULTDIR keyword in a call to SQLConfigDataSource. |