|Navigation: Templates > Guide to all Templates > Extension Templates >====== ADO Support Template - Global Extension ======|
Click on a tab above to jump to a sub-topic
What is ADO?
This release of Clarion introduces template support for ADO (Active Data Objects). Your browses and forms can operate with ADO like they would with conventional databases. The big difference is that ADO uses OLE DB/ODBC as the connection means, instead of the native drivers. The ADO templates are designed to provide a similar design interface, as you are already familiar with using conventional database interfaces.
The ADO Global Extension is required for any application that will use ADO. In addition, you can set up Global Connections to ADO that can be used by any ADO-based procedure.
The ADO Support Global Extension is used to add ADO connections to use throughout your application. Press the appropriate update buttons to add (Insert), modify (Properties), or remove (Delete) an ADO connection.
In the Connections dialog window the following prompts are available:
Enter a name (string) that you wish to use to reference your connection. You can override the default name that is provided by the template.
The Connection Class references the default library used to connect to the ADO service. If you wish to use an alternate third-party class, or a class that you have written, select it from the drop list provided. Otherwise, accept the default class (Cconnection)
A cursor is a database element that controls record navigation, update ability of data, and the visibility of changes made to the database by other users.
Cursors are set and based on the type of data you anticipate working with, and where the processing will take place.
This tells the ADO connection to use the default cursor method of the particular data source. Unless your site has specific requirements that need to override this, leave this setting as is.
This value indicates that a client-side cursor supplied by a local cursor library is to be used.
This value indicates that the data provider or driver-supplied cursor is used.
For backward compatibility, this value indicates that a client-side cursor supplied by a local cursor library is to be used.
Note that the cursor settings drop list choices are all prefaced with “ad;” these are simply the ADO constant names. The descriptions of each cursor type are provided as “basic” information about the cursor. Please refer to the documentation provided by your OLE DB Provider vendor and/or DBMS for specific information about your site.
Connection String ' Build From Source
Every ADO application requires a connection string. Select from one of 5 sources to build your connection string from:
From a Login Procedure
Choose this connection source option if you want to create a login procedure for your users to connect to the ADO source. You must use the ADOLogin procedure template provided in the ADO template set. The ADOLogon procedure will identify the connection string source (dictionary, UDL file, etc.)
Enter the name of the login procedure to use here.
Your data dictionary stores ADO connection string information for each file that you imported using the ADO file driver. Press the ellipsis button to choose a Dictionary Table. The connection string will be displayed in the text box provided.
You also have the option to save the string read from the Dictionary into a Universal Data Link (.udl) file. Press the Save Connection String in UDL file button to write the string contents to an external UDL file.
The first two lines of any universal data link (.udl) file must have exactly this content:
; Everything after this line is an OLE DB initstring
After these required lines, the remainder of the .udl file consists of a connection string written in the same format used when opening a database from programming code.
UDL file read at runtime
Press the ellipsis button to load an existing UDL file to use as the connection source at runtime.
UDL file picked and read in the template
Select this option if you wish to load an existing UDL file through the current template interface, modify the connection string, and save the modified connection string to a new external UDL file.
Press the ellipsis button to load an existing UDL filename's connection string into the connection builder text window. After your changes are made, you can save the changes to a new UDL file name by pressing the Save Connection String in UDL file button.
It is not required to load an existing UDL file. You can create a custom connection string from scratch, or paste it from an alternative source.
Select this source option to manually build your connection string using the Conncection Builder. There is an option to save this string to an external UDL file.
Override dct Connection String
The Connection dialog window automatically reads the first ADO connection string it finds in the active data dictionary. Check this box to override this default connection string and build another in the Connection String text box. Unchecking this box will force a refresh of the default dictionary connection string, and overwrite your changes.
Press the Connection Builder button to create an ADO connection to a designated data source. The contents (output) of the Connection Builder will be displayed in the Connection String text box. You also have the option of entering a custom (manual) connection string here.
Call Connection Builder
The Connection Builder button calls the Data Link Properties dialog. The specifics of this dialog vary according to which OLE DB provider you choose. You may choose items and fill in four tabs within this dialog.
Note that after calling the Connection Builder, the connection string appears at the bottom of the Connection Properties dialog. The following is a sample of an MS SQL connection for the Northwind sample database using MS SQL Server's OLE DB provider:
Provider=SQLOLEDB.1;Password=xxxxxxx;Persist Security Info=True;User ID1=UserID;Initial Catalog=northwind;Data Source=servername
Save Connection String in UDL file
Press the Save Connection String in UDL file button to write the current connection string to an external UDL file. You can later use this file as your connection source in multiple applications.
From a STRING variable
Select this option to generate a call to the Connection Object using the variable specified in the String variable name template prompt. The developer is responsible to make sure that the variable is initialized before the call to the Connection Object. Use the “Before calling Connect” embed point to do this.
If you are establishing a connection to an Oracle database through the ADO support, check the Use Oracle Syntax box. This setting is also used to conditionally omit the setting of the ADO RESYNC command in order to refresh the browse after an update.
To activate special processing for Oracle dates during form updates, additional prompts are provided:
Oracle uses a special server function called TO_DATE to process date and time information through the ADO layer. Enter a string constant here that reflects the way that data and time information will be translated through the ADO layer.
Associated CW Date
Enter a valid date picture here, or press the ellipsis to build a picture in the Picture Editor dialog.
Associated CW Time
Enter a valid time picture here, or press the ellipsis to build a picture in the Picture Editor dialog.
The picture tokens that you select in the CW Date and Time fields MUST MATCH the format string in the TO_DATE format entry. For example, for the following string:
Use a @D10- token to match the date portion, and @T4 to mtch the time string. If you change any part of the TO_DATE format, you will need to modify the appropriate CW date or time picture token.
The Classes tab contains an extensive list of default classes used with the ADO templates. Unless you specifically create a new class definition, or, obtain one from a third-party vendor, you should accept the default class settings.