Database <odbc_Database>

Synopsis

This design is used to provide access to the ODBC database. It is usually used in conjunction with the ODBC_Recordset design . ODBC drivers are provided with your database software, or with other products such as Microsoft Excel or Microsoft Access.

You need a single instance of this design in your model for each data source that you access.

Typically, you have a single child part of this design , under your main root node, or in some other well known place.

Mixins

odbc_BasePart

Canonicals

Name Type Description
connectString string Resulting connection string . It comes in formatted as per ODBC requirements. The example of this string is: ODBC;DSN=PEFRESULTS;UID=SuperAdm;PWD=Password

Parameters

Name Type Description
dsn string The ODBC data source name to use. This must be defined, externally, before it is used. The DSN is a DBMS-independent way of naming the "data source". Please use "ODBC Data Source Administrator" to create, edit, and delete DSNs.
userID string The user name to use to log in to the database, if this is required. Default value is "Admin". Caution: never disclose your userID/password combination to anyone, and don't store your credentials in the open source designs
password string The password to use to log in to the database, where this is required. Default value is "" (empty string ). Caution: never disclose your userID/password combination to anyone, and don't store your credentials in the open source designs
loginTimeout number Timeout for login in seconds. Default value is 15. Check with you ODBC driver/database server documentation whether this value is supported.
initialQueryTimeout number Timeout for query execution in seconds. Default value is 15. Check with you ODBC driver/database server documentation whether this value is supported.
useCursorLibrary? boolean Specifies whether the ODBC Cursor Library DLL should be loaded. The cursor library masks some functionality of the underlying ODBC driver, effectively preventing the use of dynasets (if the driver supports them). The only cursors supported if the cursor library is loaded are static snapshots.
readonly? boolean Specifies whether the database connection should be opened in the read-only mode, thus preventing from modification of data
reuse? boolean Obsolete.

Rules

Name Type Description
Provider name Specifies the provider specific logic. For example for MSAccess, the ADO will be involved. Possible values: Oracle, SQLServer, MSAccess, DB2, Excel Currently only MSAccess is supported. If the value is NoValue (by default), then ODBC mechanism is involved
UNCPath string Full file name of the Access database.
exclusive? boolean Whether Access db is open in exclusive mode

Methods

executeSQL( SQLstring As String, _
            Optional ignoreErrors? As Boolean = False ) As Boolean
Executes an SQL command string for the database. Generally used for creating tables and other administrative purposes, not for queries. If $ignoreErrors is supplied as True , then database errors are ignored. * SQLstring - SQL command * ignoreErrors? - If True , then any database errors are not reported
getConnectionString( ) As String
Returns the connection string as it interpreted by ODBC driver. It might be different from what "connectString" rule may contain
getCatalogNames( ) As List
Returns a list of the database catalog names. Not all DBMS provide support for catalogs. Catalogs may contain one or more schemas.
getSchemaNames( catalog As String ) As List
Returns a list of the database schema names. A schema is a collection of database objects created by a particular user. * Catalog - Name of the database catalog. Provide "" (empty string ) when the ODBC driver does not support concept of catalogs.
getTableNames( catalog As String, _
               schema As String ) As List 
Returns a list of the table names that belong to a particular catalog/schema. * Catalog - Name of the database catalog. Provide "" (empty string ) when the ODBC driver does not support concept of catalogs. * Schema - Name of the database schema. Provide "" (empty string ) when the ODBC driver does not support concept of schemas.
getColumnNames( catalog As String, _
                schema As String, _
                table As String ) As List
Returns a list of column names in the table. * Catalog - Name of the database catalog. Provide "" (empty string ) when the ODBC driver does not support concept of catalogs. * Schema - Name of the database schema. Provide "" (empty string ) when the ODBC driver does not support concept of schemas. * Table - Name of the table or view.
getFieldInfo( catalog As String, _
              schema As String, _
              table As String, _
              field As String ) As List
Returns a list describing the particular field in the table. * Catalog - Name of the database catalog. Provide "" (empty string ) when the ODBC driver does not support concept of catalogs. * Schema - Name of the database schema. Provide "" (empty string ) when the ODBC driver does not support concept of schemas. * Table - Name of the table or view. * Field - Name of the field (column) in the table or view

Example 1

Connection to ODBC database

The following code connects to DSN "PERFRESULTS":

Child Name : DBConnection
Child Design : odbc_Database
Name Type Supplied
dsn string "PERFRESULTS"
userID string "User"