## Establishing/Closing the Connection to the Database Instance

In this example you use the connect and release methods of the sdb.sql module. You establish a connection to the MaxDB database instance and then close it.

### Procedure

...

1. 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 instance

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

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

#

# Close connection to the database instance

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

session.release ()

2. Call the Python script:

python sample.py MONA RED DEMODB

See also:

Examples for the sdb.sql Module