Python: Example No. 2 

Set up a user session with the REPMServer
Log on to the database instance
Log off

 

# Reference to Python Libraries

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

import sys

import repman

 

# Parse the call arguments

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

user = sys.argv [1]

pwd = sys.argv [2]

dbname = sys.argv [3]

data_path = sys.argv[4]

host = ''

 

# Connect to Replication Manager

# A new instance of the repman object is created

# Host determines the location of the REPMServer

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

session = repman.RepMan (host, dbname)

 

# Connect to database

# The cmd method is used for this purpose

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

session.cmd ('use user %s %s;' % (user, pwd))

 

# Log off by releasing the instance

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

del session