Using Data SourcesData Source Basics, Operations, and PropertiesA Tango data source contains all the information needed to connect to a particular database. You use data sources to tell your Tango applications which databases to connect to. You use Tango Editor to create and manage data sources. Both Tango Editor and Tango Server need to see the data source required to access a particular database. Tango Editor uses a data source--via the Data Source workspace--so you can see information in the form of table and columns. Tango Server requires the same data source so it can access the database tables and columns specified within the application file. The data source properties show the information about the data source, including information about its tables and columns. This chapter covers the following topics:
![]() About Data Sources |
|||||||
Tango Enterprise for
|
ODBC Data SourcesOpen Database Connectivity (ODBC) is a standard developed by Microsoft to allow applications like Tango to communicate with a wide variety of databases from different vendors. An ODBC client application talks to the ODBC driver manager that in turn talks to a database driver for a specific type of database. An ODBC driver is a kind of translator. It converts the standard ODBC requests made by the application into a format that can be understood by the target database system. ODBC drivers are available for accessing many database management systems (DBMS). Microsoft Access, Excel, Oracle, SQL Server, Informix, Sybase, and Butler SQL are some examples of databases that may be accessed through ODBC. Before creating an ODBC data source, you must set up your database server and create or install a database on this server. Depending on the database system, you may also need to install and configure additional software to allow you to connect to the server. Consult your database software and ODBC driver documentation for specific instructions. The ODBC system software is installed automatically with Tango, and you need an ODBC driver for the type of database you are connecting to. |
||||||
For more information, consult the documentation that accompanied your ODBC drivers. |
Some ODBC drivers are self-contained. The driver itself accesses and updates the database files. For these ODBC drivers, no other software is required.
Oracle Data SourcesOracle is a high-performance client/server DBMS. To create and use Oracle data sources, you must have Oracle's SQL*Net installed. Tango supports SQL*Net versions 7.1 and 7.3, and greater. ![]() The Data Sources WorkspaceYou perform most data source operations in the Data Sources workspace. To open the Data Sources workspace, click the Data Sources tab in the workspace window. When you open the Data Sources workspace, you see a folder for each type of data source that Tango supports.
The bolded data source name in the workspace indicates the currently active data source--that is, the data source assigned to the front-most open action window. If no database actions are active, no data source names are bolded. Once a connection is made to a data source, the user name used for the connection appears in parentheses after the data source name. This avoids any confusion when different logins are being used for the same data source. ![]() Using the Primary Column KeyA primary key is a column (or combination of columns) whose value uniquely identifies each row in a table. For example, a customer number might be the primary key in a customers table. In the Data Sources workspace, Tango Editor displays the column/key icon next to a column name to show that it is part of the primary key for the table. |
||||||
![]() |
Tango builders rely on the primary key column values in various places to identify specific records. When using the builders, it is important to first check that the primary key for each table involved is set correctly. If the specified column or columns do not uniquely identify each record in a table, unexpected results can occur when executing the file. For example, if you mistakenly set the primary key for a customer table to the "state" column (many customers likely share the same state), using the resulting file to delete a particular customer deletes all the customers in the same state. When connecting to a data source, Tango Editor chooses default primary keys by scanning each table for the first column with an appropriate data type (numeric or character). Primary key columns appear with a column/key icon to differentiate them. You identify a column as a primary key or not by doing one of the following:
![]() Data Source OperationsCreating a Data SourceODBCBefore you create an ODBC data source, make certain the required ODBC drivers are installed and your database server is running (or, for drivers that access local files, your database files are available). To create an ODBC data source |
||||||
You can also right click the Data Sources workspace to display a menu to select the New command from. |
|||||||
See your ODBC driver documentation for detailed configuration instructions. |
The Create New Data Source dialog box guides you through the rest of the process. Follow the instructions that appear. OracleBefore creating an Oracle data source, make sure the correct Oracle client software is installed and the database server you want to connect to is available on the network. To create an Oracle data source |
||||||
You can also right click the Data Sources workspace and choose New from the context-sensitive menu. |
Modifying a Data SourceTo modify a data source |
||||||
You can also right click the Data Sources workspace to display a menu to choose Modify from. |
|||||||
For information on changing the settings for each type, see "Creating a Data Source" . |
If a modified data source is already loaded, the data source is reloaded automatically using the new settings. For Oracle data sources, modifying a data source does not affect Tango application files already using that data source, even if they are open when the modification is made. To update a document with the new settings, you must reassign the data source to the document by choosing Set Data Source from the Data Source menu. Deleting a Data SourceTo delete a data source
|
||||||
Reloading a Data SourceIf the structure of your database changes while Tango Editor is open, you need to reload the data source. To reload a data source |
|||||||
You can also right click the Data Sources workspace to display a menu to choose Reload from. |
Handling Unknown Data SourcesFor Oracle data sources, actions do not rely on anything in Tango Editor's list of data sources to connect to a data source. When connecting, Tango Editor uses only the information stored in the data source. For this reason, Tango Editor could connect to an action's data source while not having a data source defined with matching parameters. Such a data source is called an unknown data source.
|
||||||
For more information on the default log in settings, see "Development Tab" . |
When you open an action having an undefined data source in Tango Editor, yet Tango Editor is able to connect to it, the unknown data source is added automatically to the list in the Data Sources workspace. The log in information for the new data source is set to the defaults. This happens even if there is a data source defined with the same parameters, but with a different data source name. That is, all of the pieces of data source information must match in order for an existing one to be used. ![]() Working With Data Source PropertiesWhen you select a data source, a table, or a column in the Data Sources workspace, the corresponding Properties window appears. These windows allow you to view information about the selected object. Setting Log In Options for a Data SourceThe Data Source Properties window contains three tabs: General, Development, and Deployment. Click a tab to display the corresponding properties section. General TabThe General section shows the information making up the data source. The following is an example of the information for an ODBC data source called "MyDataSource". The data source name and type appear for all data sources, but the information in the other fields depends on the type of data source.
To edit the selected data source, choose Modify. The data source editing dialog box for the data source appears. When you close the dialog, any new settings appear in the General section. Development TabThe Development section shows the log in information required by Tango Editor for connection to the data source. The Development tab in the properties dialog box asks for a user name and password for each type of data source. The Ask each time option means Tango Editor always asks for connection information when needed. For new data sources, this option is selected by default. Deployment TabThe Deployment section allows you to specify different log in information to be used when Tango Server executes the action the data source is assigned to. The Username and Password fields may also contain meta tags that are substituted when Tango Server executes the application file. The Same as development option is the default, meaning the user name and password used during development is also used by Tango Server. When you right click the Username and Password fields, a menu appears containing standard editing commands, as well as the Insert Meta Tag command. You can use Insert Meta Tag to insert many of the commonly used Tango meta tags. Before connecting to a data source, Tango checks the data source parameters for the presence of meta tags. If meta tags are found, the substitution is performed, and the results are used for establishing the connection. If no meta tags are found, the data source parameters are passed literally. The following example shows that user name and host name are obtained from the user variables username and hostname, respectively. The user password is taken from the file, whose name corresponds to the user name, anchored by the .pwd extension. Username: <@VAR NAME="username"> Password: <@INCLUDE FILE="<@VAR username>.pwd"> Table PropertiesTable Properties shows the name, owner, and type of table.Column Properties The Column Properties window displays the name, title, data type, length, whether nulls are allowed or not, and whether the column is a primary key or not. In this dialog box, you can edit the Title field, and select the Primary Key option.
![]() Connecting to Data SourcesWhen you expand a data source in the Data Sources workspace you have not connected to, the log in information specified in the Data Source Properties Development window is used for the connection. If you selected the Ask each time option, the Log In dialog box appears allowing you to type your user name and password. |
||||||
For more information, see "Connecting to Large Data Sources". |
If a data source has more than the specified minimum number of tables (the default is 25), the Select Tables dialog box appears, allowing you to work with a more manageable subset. Connecting to Large Data SourcesWhen Tango Editor connects to a data source containing more than 25 tables, it presents the Select Tables dialog box, allowing you to select which tables you want to work with. The Available tables list shows the tables in the data source. Drag the tables you want to work with from this list into the Tables to use list. You can use the Owner and Type drop-down lists to filter the tables shown in the Available tables list. For example, to show only tables owned by a specific user, select that user from the Owner drop-down list. To show only system tables, select SYSTEM TABLE from the Type drop-down list. (The contents of these drop-down lists are determined by the data source; only owners and types existing in the database are listed.) You can also invoke the Select Tables dialog box at any time to select the tables to work with. From the Data Source menu, choose Select Tables to invoke the dialog box. Editing and Executing Files on Different ComputersWhen connecting to a data source, Tango relies on configuration information not included in the Tango application file itself. This becomes an issue when Tango Editor and Tango Server reside on different computers, and when editing a file created on a different computer. Tango cannot connect to the data source unless the computer is set up correctly. The following explains what pieces of data source information are stored in the file, what ones are not, and how to ensure a file works on a computer other than the one it was created on. ODBC Data SourcesFiles assigned ODBC data sources have these pieces of information stored in them: For the data source connection to be made on another computer, a data source with the same name pointing to the original database must exist. The user name and password must also be valid for the server pointed to by the data source. Oracle Data SourcesFiles assigned Oracle data sources have these pieces of information stored in them: If you specified a SQL connect string (such as T:199.230.9.8:ORCL) when defining the data source, your Tango file works on any computer the string points to that has access to the Oracle database server. This is because all the connection information is stored right in the string. ![]() Assigning Data Sources to ActionsTo assign a data source to an action, simply drag a column from a data source to an action editing window.
|
||||||
For more information, see "Setting Log In Options for a Data Source". |
If Tango Editor has not yet connected to the data source, a log in dialog box may appear. This dialog box only appears if you have the Ask each time option enabled, which is the default, in the Development section of the Data Source Properties window. If an action already has a data source assigned to it and you drag a column into it from a different data source, you are asked if you want to cancel the operation or to use the new data source instead.
If you use a new data source, Tango Editor scans the affected actions to update the table owner information to match the new data source. |
Copyright © 1998, Pervasive Software Inc. All rights reserved.