Community Wiki

ODBC Connection Strings

From Ingres Community Wiki

Jump to: navigation, search

The ODBC functions SQLDriverConnect() and SQLBrowseConnect() require connection strings. Other ODBC-based applications, such as the OLE DB provider for ODBC used in ADO applications, require connection strings.

The connection string has the form:

   DSN=data_source_name[;attribute=value[;attribute=value]...]

If you have an ODBC DSN (Data Source Definition) defined, the attribute "DSN=dsnName" is the only minimum attribute required. If you specify the DSN connection string attribute, other attributes specified in the connection string override equivalent attributes in the ODBC DSN definition.

Without an ODBC DSN definition, the minimum attributes required for a database connection are the SERVER, SERVERTYPE, and DATABASE attribute/value pairs. DSN-less connection strings have the form:

   CONNECTSTR=SERVER=server_name; SERVERTYPE=server_type; 
       DATABASE=database;[attribute=value]…]

The following table provides the keyword for each connection string attribute.

Keyword (Attribute) Value Description
DSN Data source name.
DRIVER Driver Name as returned by SQLDrivers(). Normally the default is "Ingres".
UID User ID to override vnode definition. If specified, PWD must also be specified.
PWD Password to override vnode definition. If specified, UID must also be specified.
DBMS_PWD Database password. Database passwords are defined by the accessdb or VDBA utilities or by the CREATE USER SQL command.
SERVER Vnode name
SERVERTYPE Server type (for example, INGRES, IDMS, or DB2)
DATABASE Database name as defined on the server
DB A synonym for DATABASE
ROLENAME Role name to override vnode definition
ROLEPWD Role password to override vnode definition
GROUP Group identifier for the session. Equivalent to the -G flag of the Ingres command-line flags.
BLANKDATE =NULL Indicates that the driver must return empty string DATE values as NULL
DATE1582 =NULL Indicates that the driver must return values of ‘1582-01-01’ as NULL
DATE Same as DATE1582 keyword
SELECTLOOPS =N Indicates that Cursor Loops must be used
CATCONNECT =Y Indicates that a second separate Ingres session must be used for catalog functions (SQLTables, and so on)
NUMERIC_ OVERFLOW =IGNORE Indicates that no error is issued if an arithmetic error of numeric overflow, underflow, or divide by zero occur. Equivalent to “-numeric_overflow=ignore” command line flag.
CATSCHEMANULL =Y Returns NULL for schema names form ODBC catalog functions
Personal tools