Nidhi Srivastava wrote:
> Problem is if any client application is connected to another database on
> my server anywhere, I shall not able to create my database using
> template1. How can I determine which other clients are connected to my
> server?
It's not "another database", it is specifically the database that you
are using as the template for CREATE DATABASE that must be idle. See the
CREATE DATABASE docs for details.
Usually template1 is not used for anything else so there's no problem. I
suspect that pgAdmin is connecting to template1 *as well* as to the
database you request -- so just the act of running it means that noone
else can CREATE DATABASE from template1.
Whatever database you end up using as a template, you will need to
ensure that there's noone else connected to it. If having random users
connect to the template DB is a problem, then consider using pg_hba.conf
to enforce this -- i.e. don't let people connect to template1 in the
first place unless they are a particular user who is allowed to CREATE
DATABASE..
This is not JDBC-specific though. I suggest you take the discussion to
pgsql-general where there's a wider audience and you may get more help.
-O