1. Creating the Python file sample_1.py:
#
# Reference to Python Libraries
# ----------------------------
import sys
import sapdb.dbm
#
# Parse the call arguments
# --------------------------
dbm_user = sys.argv [1]
dbm_user_password = sys.argv [2]
database_name = sys.argv [3]
#
# Logon to the Database Manager
# ------------------------------------------------------
session = sapdb.dbm.DBM (’’, database_name, ’’, dbm_user + ’,’ + dbm_user_password)
#
# Log off from Database Manager
# -------------------------------------
session.release ()
2. To call the Python file sample_1.py from the command line and transfer DBM user OLEG’s data to the Python program with the password MONDAY and the database instance named DEMODB, specify the following:
python sample_1.py OLEG MONDAY DEMODB
The following examples specify a shortened login process:
dbm_user_name, dbm_user_password, database_name = sys.argv [1:4]
session = sdb.dbm.DBM (’’, database_name, dbm_user_name + ’,’ + dbm_user_password)