OdbcSetConnectAttr Function

Action

Modifies the current value of a specified connection attribute.

Include file

ODBC.bdh

Syntax

OdbcSetConnectAttr( in hDbc       : number,
                    in nAttribute : number,
                    in sValue     : string): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
hDbc Handle to a database connection.
nAttribute

Connection attribute whose value is to be modified . This parameter must be set to one of the following values:

  • SQL_ATTR_AUTOCOMMIT

  • SQL_ATTR_CONNECTION_TIMEOUT

  • SQL_ATTR_CURRENT_CATALOG

  • SQL_ATTR_LOGIN_TIMEOUT

  • SQL_ATTR_METADATA_ID

  • SQL_ATTR_ODBC_CURSORS

  • SQL_ATTR_PACKET_SIZE

  • SQL_ATTR_TRACE

  • SQL_ATTR_TRACEFILE

  • SQL_ATTR_TRANSLATE_LIB

  • SQL_ATTR_TRANSLATE_OPTION

  • SQL_ATTR_TXN_ISOLATION

sValue New value for the connection attribute.

Example

var
  hEnv, hDbc : number;

dcltrans
  transaction TLogon
  begin
    OdbcAlloc(SQL_HANDLE_ENV, hEnv);
    OdbcAlloc(SQL_HANDLE_DBC, hDbc, hEnv);
    OdbcSetConnectAttr(hDbc, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_ON);
    OdbcConnect(hDbc, "DSN=database;UID=user;PWD=pass;");
  end TLogon;