| Stonefield Query SDK |
| Creating a New Stonefield Query Project |
To create a new project, start Stonefield Query Studio and click the New Stonefield Query Project button () in the toolbar. Alternatively, you can click the New Project link in the Tasks section of the Start Page. The New Project Wizard appears.
Step 1 of the dialog has the following options:
Unlike other reporting and querying tools that have no specific knowledge of a particular database, Stonefield Query has detailed knowledge about the databases it queries against. That's the key to Stonefield Query's ease of use: the users don't have to know what a join is, let alone how to create a join for a particular set of tables, nor do they have to know the names of tables and fields.
What gives Stonefield Query this knowledge about the databases is its data dictionary. The data dictionary has information about the databases themselves (where they are located and how to access them) and their tables (their names and descriptive headings), fields (names, headings, data types, formats, and so forth), and relationships (the expressions used to join pairs of tables).
Filling in the Stonefield Query data dictionary for a database would be a very tedious process if you had to do it by hand. Fortunately, Stonefield Query Studio has a feature to "discover" the meta data for a database. You do this by specifying in Step 2 how to connect to the database you want Stonefield Query to report on. Studio creates the meta data (information about the data structures) for the database and all of its tables, fields, and relationships.
There are four available choices:
The first option in the dialog is Caption. This is used as the descriptive name for the database the user sees in Stonefield Query.
For ODBC or OLE DB, you can specify which characters to use as delimiters around table and field names that need delimiters (for example, names with spaces in them) in the Name delimiters setting. Specify a two-character value, with the first character being the left delimiter and the second being the right. The default delimiters are "[]," meaning names are delimited with square brackets.
If you select ODBC, choose DSN if you have an existing data source for the database. Select the ODBC data source name from the list of defined data sources on your system, and optionally enter the user name and password for the database (you can leave these blank to use a "trusted" connection such as Windows integrated security with SQL Server). Note that the DSN doesn't have to exist on the end-user's system; it's only used for the discovery process.
If you select ODBC, choose Connection string if you don't have an existing DSN for the database and you're familiar with the format of an ODBC connection string. Enter the connection string to access the database. The string should contain the name of the driver, the database name, the user and password (if they're required), and any other clauses needed by the database. For example, here's a connection string to access the SQL Server Northwind sample database:
driver=SQL Server;server=servername;database=Northwind; uid=username;pwd=password
where servername is the name of the server, username is the user name, and password is the password.
If the DSN doesn't exist and you don't want to use a connection string, be sure to create a DSN.
If you select OLE DB, you can either enter the connection string to access the database or click the Build button to display the Windows Data Link Properties dialog, which allows you to visually create the connection string by making the appropriate choices in the dialog. Note that it's better to select the correct OLE DB provider for your database engine than to use the generic Microsoft OLE DB Provider for ODBC Drivers, since that provider doesn't have all of the features of a specific provider. For example, the ODBC provider cannot read relationships between tables from databases such as SQL Server or Access.
If you select Visual FoxPro, there are three ways you can select the data:
Regardless of the choices you've selected, turn on the Add all tables to data dictionary option if you want all tables automatically added to the data dictionary or turn it off if you want to select which tables to add. Turn on the Include views option if you want views included.
The Prompt for subtables option allows you to indicate whether you are prompted for subtable names when multiple relationships are found between tables or a table has a self-join. While this is turned on by default, you may wish to turn it off if you don't plan on dealing with multiple relations and don't want to be prompted for them every time you refresh the data dictionary.
Once you've filled in all the information in the New Project Wizard, click the Finish button. If you turned off the Add all tables to data dictionary option, select which tables you want added in the Select Tables dialog that appears next (views are included if you turned on the Include Views option). If your database has different schemas or user names, an additional drop-down list of the available schemas or user names appears so you can see the tables in the selected one.
Stonefield Query Studio then examines the database structure and creates meta data for all of the tables, views (if you turned on the Include Views option), fields, relationships, and so on. During the process, you can press Esc to cancel it at any time. If any errors occurred while trying to read the structure of the database, an error message appears informing you of this. Otherwise, the database and its tables, fields, and relationships appear in the Database panel of Stonefield Query Studio.
As it creates the meta data for the database, if Stonefield Query Studio discovers any self-joins or more than one relationship between the same set of tables, it stops and informs you that it needs to create a subtable so the relationship can be handled properly in Stonefield Query. This is the dialog that appears for self-joins:
This is the one that appears for multiple relationships:
In either case, specify the name of the subtable to create. If there are existing subtables for the table, select one from the drop-down list. See the Creating a Subtable topic for information on subtables.
Note: if you use the Microsoft OLE DB for Oracle provider, you are asked if you want to the use Oracle provider instead. The Oracle provider supports some features the Microsoft provider does not, so it's a good idea to choose Yes.
Note: if you are accessing the IBM iSeries DB2 ODBC driver, be sure to configure your DSN to convert binary data to text on the Translation page of the ODBC setup dialog.
You can specify that a database login dialog should appear when Stonefield Query Studio connects to the database by adding DispLogins=2 to a [Settings] section in SFQEditor.INI (if that file doesn't exist, create it).
Stonefield Query Studio creates the project files and opens them.
| Last Updated: 06/10/10 |