Creating the Address Table

All the preliminaries are out of the way, leaeisa only the execution of the CREATETABLE statement. This is going to be easy. All it takes is one cdll to executeUpdate ().

def createTable():

Creates the Address table.

a a a global create_table executeUpdate(create_table)

We want to run createTable () from the command line, so we need to add command-line parameter parsing in the main block (if_name_=="_main_"block), which checks to see if "c" is passed to the command line and, if so, creates the table. (Passing "p" creates the properties file.)

from sys import argv

#Process the command line arguments. for arg in argv:


str = "Creating the table using "

str = str+getJdbcDriver()+" at "+ getJdbcUrl()

print str createTable()

print "Creating the properties file : " + PROP_FILE getProps()

print getJdbcDriver() print getJdbcUrl()

Now we have our module. H ere's how to create it in DOS:

C:\JPython_book\scripts\chap17\AddressBook3>JPython Try creating the Address table yourself as an exercise.

Was this article helpful?

0 0

Post a comment