Programming Issues
After establishing a connection between Thoroughbred products and ODBC-compliant databases, some of the following programming issues may arise:
- To use Thoroughbred Basic directives to manage databases, please refer to the information in Thoroughbred Basic Directives.
- Under Microsoft Windows, the Thoroughbred Basic File menu contains an ODBC menu option. For more information on the options, please refer ODBC Menu Options.
- For more information on data sources, please refer to Data Sources.
- For more information on how some ODBC-compliant databases manage record locking, please refer to the information in Record Locking.
Thoroughbred Basic Directives
Section titled “Thoroughbred Basic Directives”To access ODBC-compliant database tables, you must define links and formats under Dictionary-IV. Step 5 of the procedural example illustrates one way to accomplish these tasks.
If you plan to use Thoroughbred Basic to manage these database tables, some directives will require an argument to enable Dictionary-IV access. The OPEN, ERASE, RENAME, and INITFILE directives all provide the OPT=“LINK” argument.
For example, you can create an ODBC database table with the following Thoroughbred Basic directive:
OPEN (channel, OPT="LINK|CREATE") "link-name"For more information on the directives listed above, please refer to the Thoroughbred Basic Language Reference.
ODBC Menu Options
Section titled “ODBC Menu Options”If an ODBC data source is specified in the IPLINPUT.TXT file, the Microsoft Windows Thoroughbred Basic menu bar File menu will contain an entry for ODBC. The ODBC menu options are:
- Show ODBC Errors
- enables or disables an error dialog box, which displays errors returned from the ODBC driver manager.
- Log ODBC Errors
- enables or disables error logging. When error logging is active, the ODBCERR.LOG file will include the name of the Thoroughbred Basic program, the line number, the ODBC error returned from the ODBC driver, and a description of the error.
- Debug SQL
- enables or disables a dialog box that displays the SQL statement sent to the ODBC driver.
Data Sources
Section titled “Data Sources”Thoroughbred products do not create data sources. Data sources must exist before Thoroughbred Basic attempts connection.
Data sources are not database tables. Your application can create new database tables within existing data sources.
Valid data source names can contain the letters A through Z, the letters a through z, and the digits 0 through 9. Data source names are case-sensitive.
Record Locking
Section titled “Record Locking”Not all ODBC-compliant databases support row-level locking. For these databases, advisory locking is used. When a WRITE directive updates a row, advisory locking compares the original record to the record on disk. If they are still the same, the WRITE directive works. If they are not the same, the WRITE directive returns a locking error. For databases that do not support row-level locking, you may need to test Busy (Error 0) on the WRITE directive rather than on the EXTRACT directive.
From the ODBC Client Capability Supplement, version 8.9.1. Open this page in the PDF