Entering content frame

This graphic is explained in the accompanying text CONNECT Statement Locate the document in the library structure

 

1. Creating the Python file sample_1.py:

#

# To reference Python libraries:

# -------------------------------------------

import sys

import sapdb.sql

#

# Parse the call arguments

# -------------------------------------------

database_user = sys.argv [1]

database_user_password = sys.argv [2]

database_name = sys.argv [3]

#

# Starting the session with the database instance

# -------------------------------------------

session = sapdb.sql.connect (database_user, database_user_password, database_name)

#

# Ending the session with the database instance

# --------------------------------------------

session.release ()

 

2. To call the Python file sample_1.py from the command line and transfer database user MONA’s data to the Python program with the password RED and the database instance named DEMODB, specify the following:

python sample_1.py MONA RED DEMODB

 

 

Leaving content frame