Context
In this example, you use the
connect method (sdb.sql module) and the
release method (SapDB_Session class). You establish a connection to an SAP MaxDB database and close it again.
Procedure
- Create a Python script
sample.py with the following contents:
# # Import Python modules # -------------------------------------------
import sys
import sdb.sql
# # Parse call arguments # -------------------------------------------
database_user = sys.argv [1]
database_user_password = sys.argv [2]
database_name = sys.argv [3]
# # Connect to the database # -------------------------------------------
session = sdb.sql.connect (database_user, database_user_password, database_name)
# # Close connection to the database # --------------------------------------------
session.release ()
- Call the Python script:
python sample.py MONA RED DEMODB