Entering content frame

This graphic is explained in the accompanying text Example 1 Locate the document in its SAP Library structure

The following example shows you how to create a database session using Loader and how to log on and log off a database instance.

# To reference Python libraries:
# ----------------------------

import sys
import loader

# To parse call arguments:
# --------------------------

user_name = sys.argv [1]
password = sys.argv [2]
database_name = sys.argv [3]

# To create a Loader session: (The most recent version of

# Loader is started, there is still no connection

# to the database)
# ------------------------------------------------------

session = sapdb.loader.Loader ()

# To log on to the database instance:
# -------------------------------------

session.cmd ('use user %s %s serverdb %s' % (user_name, password, database_name))

# To log off:
# -------------------------------------

del session

Variant

To prevent the user name and password from being converted into uppercase, enclose "use user" within double quotes in your command.

session.cmd ('use user "%s" "%s" serverdb %s' % (user_name, password, database_name))

 

Leaving content frame