#must be run as user postgres require "postgres" dbName="test" #whatever the databases name is system("createdb",dbName) #this will use the program createdb to add a database #might have to specify full path to createdb con=PGconn.new("sittingroom",5432,nil,nil,dbName,"postgres") #new(pghost, pgport, pgoptions, pgtty, dbname, login, passwd) #notice i have no set password con.exec("create table myTable(name varchar(35) not null primary key,manager_first_name varchar(25) ,manager_second_name varchar(35) ,staff_no varchar(15) ,address varchar(65) not null);") #actually creates the table For more info go to http://www.postgresql.jp/interfaces/ruby/reference.html Copyright James McCarthy 23/8/2004 (my first working Ruby code using PostgreSQL)