Show TOC

connect Method (sdb.dbapi Module)Locate this document in the navigation structure

Use

connect is a method of the sdb.dbapi module for opening database sessions.

Prerequisites

The database is in the ONLINE operational state.

Features
connect (user, password, database, host ='', **config)
			

Attribute

Description

user

Name of the database user

password

Password of the database user

Note that the password is case-sensitive.

config

  • autocommit

    on | off

    AUTOCOMMIT mode

  • sqlmode

    internal | oracle

    SQL mode

  • isolation

    More information: Isolation Level

  • timeout

    <integer>

    Command timeout in seconds

Result

  • Successful execution: Object of class sdb.dbapi.Connection

  • If an error occurs: Exception of sdb.dbapi.Error class

For more information, see the Python Database API Specifications V2.0 at http://www.python.orgInformation published on non-SAP site

Example
session = sdb.dbapi.connect ('MONA', 'RED', 'DEMODB', '', autocommit = 'off', sqlmode= 'oracle', isolation = 1, timeout = 90)