dbTalk Databases Forums  

can i create a database programmatically?

comp.databases.postgresql.novice comp.databases.postgresql.novice


Discuss can i create a database programmatically? in the comp.databases.postgresql.novice forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Zhenchang Xing
 
Posts: n/a

Default can i create a database programmatically? - 10-18-2004 , 04:31 PM






hi,

The problem I have is: I have a database template, which define several
tables, contain some pre-defined data, and some server-side extensions,
and so on.

I am doing software evolution analysis. A user of my application can
define one or more analysis sets, which contain different sets of software
products. I want each analysis set to have a corresponding database
created from the template. But I don't want the user to create it on the
command line, such as using createdb. The way I want them to use my
application is, just select the software products of their interest and
give the analysis set a name, and then my applicatin will take care of
creating the corresponding database (with the specified name) for them. So
the question is, can I create
a database programmatically? It seems I can't through client interfaces,
such as JDBC, since they require to connect to a database first. Can I
connect to built-in template1 database, and call, for example,
execute("CREATE DATABASE newdb ...") from within JDBC?

thanks
zhenchang


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org


Reply With Quote
  #2  
Old   
Steven Klassen
 
Posts: n/a

Default Re: can i create a database programmatically? - 10-18-2004 , 04:54 PM






* Zhenchang Xing <xing (AT) cs (DOT) ualberta.ca> [2004-10-18 15:31:04 -0600]:

Quote:
Can I connect to built-in template1 database, and call, for example,
execute("CREATE DATABASE newdb ...") from within JDBC?
It's a query like any other - that should work fine.

--
Steven Klassen - Lead Programmer
Command Prompt, Inc. - http://www.commandprompt.com/
PostgreSQL Replication & Support Services, (503) 667-4564

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.