User Tools

Site Tools


using_sql_tables_in_your_clarion_application.htm
Navigation:  SQL Drivers >====== Using SQL Tables in your Clarion Application ====== Previous pageReturn to chapter overviewNext page

Register the SQL Accelerator Driver

Before your application can use a particular database driver, the driver must be registered with the Clarion development environment. The in-the-box drivers are already registered when you install Clarion. You must register any add-on drivers. See Clarion's Development Environment–Database Driver Registry in the User's Guide for information on registering database drivers.

Import the Table Definitions

Typically, you add SQL support to your application by importing the SQL table, view, and synonym definitions into your Clarion Data Dictionary. See The Dictionary Editor–Importing File Definitions in the User's Guide for general information on importing table, file, and view definitions. This section describes SQL Driver imports generally. Driver-specific import information is described in the chapter or manual for each driver.

Although you can manually add table definitions to the dictionary (or even hand code your FILE declarations) for your SQL tables, we strongly recommend importing the table definitions. Importing the table definitions reduces the chance of introducing errors into the dictionary and guarantees the correct specification of data types, key structures, etc.

The importing approach assumes your SQL tables are already defined within the SQL database. In the case where you are designing a new SQL database, you may, of course, lay out the table definitions for the first time in the Clarion Data Dictionary. However, we recommend this approach only for prototyping and for databases with minimum complexity and maintenance requirements. In most cases, to correctly implement an SQL database requires defining more items than are stored in the Clarion Data Dictionary–for example, stored procedures, triggers, access rights, and storage allocation.

Once your table definitions are in the Clarion Data Dictionary, you develop your SQL based applications just as you would any other application.

NoteBox.jpg

Driver-specific import information is described in the chapter or manual for each driver.

SQL Import Wizard–Login Dialog

When you select an SQL Accelerator Driver from the driver drop-down list, the Import Wizard opens the Login/Connection dialog. The Login/Connection dialog collects the connection information for the SQL database.

NoteBox.jpg

Before you can connect to the SQL database and import table definitions, the database must be started and must be accessible from your computer.

Fill in the fields in the Login/Connection dialog.

Next >

Press this button to open the Import Wizard's Import List dialog.

SQL Import Wizard–Import List Dialog

When you press the Next > button, the Import Wizard opens the Import List dialog. The Import List dialog lists the importable items.

Highlight the table, view, or synonym whose definition to import, then press the Finish button to import. The Import Wizard adds the definition to your Clarion Data Dictionary, then opens the File Properties dialog to let you modify the default definition.

Import additional tables, views, and synonyms by repeating these steps. After all the items are imported, return to the Dictionary Editor where you can define relationships and delete any columns not used in your Clarion application. See Advanced Techniques–Define Only the Fields You Use.

Connection Information and Driver Configuration–File Properties

Typically, you add SQL support to your application by importing the SQL or ODBC table, view, and synonym definitions into your Clarion Data Dictionary. The Import Wizard automatically fills in the File Properties dialog with default values based on the imported item. However, there are several fields in the File Properties dialog you can use to further configure the way the SQL Accelerator Driver accesses the data. These File Properties fields are described below.

Driver Options

Typically, the Import Wizard places nothing in the Driver Options field. However, you can add driver strings to this field to control how the driver accesses your SQL data. For example, you can generate a log of driver activity or specify how the driver handles dates with a value of zero (0). See SQL Driver Strings for more information.

Owner Name

Typically, the Import Wizard places the SQL database connection information (Host, Username, Password, etc.) in the Owner Name field.

For security and portability reasons, you may want to specify this connection information with variables rather than hard coded strings in your dictionary. To use a variable specification, type the variable name, preceeded by an exclamation point in the Owner Name field; for example !LoginString. Then use whatever method you choose to prime the variable before accessing the SQL table.

Some SQL Accelerator drivers allow additional information in the Owner Name field. This information is described in the documentation for each driver.

NoteBox.jpg

The SQL drivers now parse out double quotes within the owner attribute to allow commas to be passed in a section. For example, you can now do

“server,port”,database,uid,pwd

to connect to an MS-SQL database running on a non-standard port.

using_sql_tables_in_your_clarion_application.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1