OTL 4.0, OTL connect class

OTL connect class

This class encapsulates connect functions: connect, disconnect, commit, roll back, etc. In other words, the otl_connect class is the class for creating and handling connect objects together with transaction management.
class otl_connect{ 
public:
      int connected;
      static int otl_initialize(const int threaded_mode=0);
      static int otl_terminate(void);
  • OTL/OCI8, OTL/OCI9 only. Cancel any operation / database call, executing / active in the connect object / database session. Say, the database session is in the active state, or, in other words, has a running SQL statement in a thread. This function can be called from another thread, to cancel the execution of the SQL statement asynchronously. Right after the cancel() call returns, the first thread will raise an otl_exception with the following message: user requested cancel of current operation.
  •          void cancel(void);
          void change_password
          (const char* user_name,
           const char* old_password,
           const char* new_password
          );
  • Set transaction isolation level. OTL/DB2-CLI, OTL/ODBC only. The function allows the user to set the following levels: READ COMMITTED, READ UNCOMMITTED, REPEATABLE READ, SERIALIZABLE. For more detail on the transaction isolation levels, see the regular database manuls.
  •          void set_transaction_isolation_level(const long int level);
    OTL/ODBC and OTL/DB2-CLI define the following global constants, which can be used as substitutes for the level parameter of the function:
          void set_max_long_size(const int amax_size);
          int get_max_long_size(void);
          void set_cursor_type(const int acursor_type=0);
          void set_timeout(const int atimeout=0);
          otl_connect(const char* connect_str,const int auto_commit=0);
    In OTL/ODBC/OCI8/OCI8i/OCI9i/OCI10g, it is possible for a  password value to have a "@" (commercial at character) in it. In order to specify a "@" in a password, the character has to be prefixed  with a "\", for example: "userid/pass\\@word@DSN", or "UID=scott;PWD=ti\\@ger;DSN=mssql" (in these examples, "\\" was used because the examples show C++ string literals).

                void rlogon(Lda_Def* lda);         void rlogon(HENV henv, // environment handle
                        HDBC hdbc, // database connect handle
                        const int auto_commit=0 // connect auto-commit mode
                       );
    #if defined(OTL_UNICODE_EXCEPTION_AND_RLOGON)

             void rlogon(const OTL_UNICODE_CHAR_TYPE* username, // user name
                         const OTL_UNICODE_CHAR_TYPE* passwd, // password
                         const OTL_UNICODE_CHAR_TYPE* dsn, // data source name
                         const int auto_commit=0 // connect auto-commit mode
                        );

    #endif

            otl_connect(HENV henv, // environment handle
                        HDBC hdbc, // database connect handle
                        const int auto_commit=0 // connect auto-commit mode
                       );
            void rlogon(OCIEnv* envhp, OCISvcCtx* svchp);

          void logoff(void);
         void server_attach(const char* tnsname=0, 
    const char* xa_server_external_name=0,
    const char* xa_server_internal_name=0,
    #if defined(OTL_ORA_OCI_ENV_CREATE)
    bool threaded_mode=false
    #endif
    )
             // tnsname (TNS alias from TNSNAMES.ORA file) can be specified 
             // in order to connect to a remote Oracle 8 server. 
             // For local connections, tnsname defaults to 0.
             // The function attaches to the database server (local or remote).
             // The following "server attachment" attributes that are
             // required by the Oracle XA Library can be also specified:
    // server external name, server internal name. Also see rlogon().


         void server_detach(void); // detach from the Oracle 8 server
         void session_begin
             (const char* username, // user name, e.g. "scott"
              const char* password, // password, e.g. "tiger"
              const int auto_commit=0, // session auto-commit mode
              const int session_mode=OCI_DEFAULT
                // OCI_SYSDBA -- in this mode, the user is authenticated for SYSDBA
                // access.  
                // OCI_SYSOPER -- in this mode, the user is authenticated
                // for SYSOPER access.
             );

         void session_end(void);
          void session_reopen(const int aauto_commit=0 // session auto-commit mode
                                );
          void set_stream_pool_size
           (const int max_size=otl_max_default_pool_size);
    }; // end of otl_connect

    Prev NextContentsGo Home

    Copyright © 1996, 2007, Sergei Kuchin, email: skuchin@ispwest.com, skuchin@gmail.com

    Permission to use, copy, modify and redistribute this document for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies.