In this example, you use the Loader class of the sdb.loader module to start the Loader and log on to a database.
Create a Python script sample.py with the following contents:
Syntax
# Import Python modules # ------------------------------------------- import sys import sdb.loader # Call Loader # ------------------------------------------- session = sdb.loader.Loader () #Logging On to the Database # ------------------------------------------- session.cmd ("USE USER MONA RED DB DEMODB") # Close connection to the database # ------------------------------------------- session.release ()
Call the Python script:
python sample.py