Once you have cataloged the database connection, connecting to Apache Derby from pyDB2 is relatively easy.
#!/usr/bin/python
import DB2

def connect(database='MYDB', user='lynn', password='5tuff'):
	return DB2.connect(database, user, password)
#!/usr/bin/python
import sys
import DB2
# import the functions in menu.py within this script
import menu

# Create the connection with default parameter values
try:
	conn = menu.connect()

except Exception, e:
	sys.exit("Failed to connect: %s" % e)

# Here is where we would do real work; just print connection status
print "Connection succeeded!"

# Clean up the connection
conn.close()
bash$ python connect.py