Re: Create Database using JDBC
От | Markus Schaber |
---|---|
Тема | Re: Create Database using JDBC |
Дата | |
Msg-id | 43A41044.2010802@logix-tt.com обсуждение исходный текст |
Ответ на | Create Database using JDBC ("Nidhi Srivastava" <nsrivastava@quark.com>) |
Ответы |
Re: Create Database using JDBC
|
Список | pgsql-jdbc |
Hi, Nidhi, Nidhi Srivastava schrieb: > I wish to create a database if one doesn’t exist using JDBC. I tried > connecting to template1 database and then issuing the “CREATE DATABASE > test” command but I get the following error : > > ERROR: CREATE DATABASE: source database "template1" > > is being accessed by other users > > How do I resolve this? I’m using PostGreSQL8.0 This is a PostgreSQL limitation, in that you cannot use a database as template if anyone else except the one who issued the create database has a connection to it. You can either use "template0" as template (if you did not apply any modifications to template1), or create your own templateblah database which you use as template. Btw, the Debian PostgreSQL packagers seem to add an empty database called "postgresql" to each cluster, and then all tools (e. G. pgadmin) are told to use this database to connect against, so the template database is kept reserved for real templating issues. Maybe this could be adopted upstream. HTH, Markus
В списке pgsql-jdbc по дате отправления: