Database Kit |
|
This chapter details database-specific usage of the Database Kit. The sections include:
For information on current release versions of databases and their compatibility with the Database Kit and AVS/Express see the book Installing AVS/Express or our web site at http://www.avs.com/. Any critical information about database changes will be found in the release notes.
This section provides database-specific usage notes for developing and using Database Kit applications that access Oracle's standard databases, Spatial Data Option, and the Spatial Data Cartridge.
Oracle connects are either local or remote. In either case, a SQL*Net component is involved. By default, your Database Kit is linked with the SQL*Net protocols noted in Section 1.7 Database Kit Requirements of the Installing AVS/Express manual.
When connecting to a database, you must supply either a connect string or the elements from which to construct a connect string. The format of a connect string is database specific. In addition, connect strings can vary depending on how the database driver has been installed, what networking component(s) it uses, where the associated server resides, and so forth.
Generally, you should see your database administrator to obtain a valid connect string. However, this section provides some general information on Oracle connect string format. For more information, see your database documentation.
An Oracle connect string always requires a user name. In addition, it may require a user password and/or the name or alias of a database, depending on how the user's database administrator has configured the server and set up the user's account. For example, the user account may not require a password, or the user may be allowed to connect only to one database.
A typical Oracle connect string has one of the following formats:
The components have the following meanings:
Here are some examples of typical connect strings:
If SQL*Plus is available on your machine, you can use it to verify that a connect string is valid. To do this, try to connect to the tool using the desired connect string. If the connect is successful, the connect string is valid and can be used with AVS/Express. If SQL*Plus is not available on your machine, you should locate a machine on which it is installed and test the validity of the connect string there.
In some circumstances, a connect string will work with SQL*Plus but not with the Database Kit. This may occur because different network drivers are linked to the Database Kit than to the SQL*Plus; there may also be other site-specific reasons for this problem. Ask your database administrator for assistance.
In order to resolve this problem, your database administrator may need to know how the underlying layers of the Database Kit handle a connect attempt. The Database Kit uses an Oracle Call Interface (OCI) call named olog to connect to a database. Here is the format of the olog call:
Recall that you can supply either a connect string or the elements from which to construct a connect string. In either case, the connect string is passed to the Oracle server as the uid parameter of the olog call. This field contains the connect string in whatever format it is supplied. (See the previous section or your database documentation for more information on connect string formats.)
For more information on OCI and the olog call, see your Oracle documentation.
Oracle maintains data in the data dictionary as a set of internal datatypes. The following table lists these datatypes and their specifications, and notes the C-language datatype to which the Database Kit maps them. (The list of internal datatypes and specifications are derived from the Oracle documentation.)
Oracle stores all columns defined for a table as one of these internal datatypes, regardless of the exact mode of creation. For example, Oracle supports the ANSI datatypes of float, int, and so forth in the CREATE TABLE statement, but stores both the float and int data as the "number" internal datatype. When the Database Kit queries the database server about a datatype, the original, Oracle user-specified datatype - for example, "float" - is lost and the appropriate Oracle internal type - "number" - is returned along with the scale and precision as maintained internally by Oracle. The Database Kit supports only C-language datatypes, and when a nonzero scale is indicated, it stores the "float" data as C-language float or double float data.
For Oracle databases, the fetchret, fetchind, and fetchsize buffers are copied directly from the arrays used by the OCI and are not modified by the Database Kit.
The Oracle database-specific module is used to access both the standard and the Spatial Data Option databases. The OCI was used to build the Oracle database-specific module. (The version of the OCI varies by platform.) The following C-language calls are used:
AVS/Express supports the Open Database Connectivity (ODBC) interface. This section describes issues associated with developing and using AVS/Express applications that use the ODBC interface to access databases on a PC.
AVS/Express uses the ODBC product for connecting to an ODBC compliant database server. The Database Kit includes object code from ODBC libraries that are normally found in the directory C:\MSDEV\LIB. The ODBC library is called odbc32.lib.
The ODBC setup tool for Windows NT is located in the Control Panel. This setup tool maintains the ODBC data sources and drivers for connecting to a database server. This tool helps you add drivers, determine what drivers are already installed on your PC, and set up the correct connection information to the database of choice. When using the setup tool, you specify the information that is required when connecting to the database via AVS/Express; for example, the elements to establish a physical connection to the database server.
The information that follows is general connection information. The required information is database specific, so you should see your database administrator or your database documentation to obtain valid connection information.
The table below defines the connect elements and their meaning:
ODBC maintains data in the data library as a set of internal datatypes. The following table lists these datatypes and maps them to their equivalent C-language datatype.
![]() |
![]() |
![]() |
![]() |