From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Amn Ojee Uw <amnojeeuw(at)gmail(dot)com> |
Cc: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: My 1st JDBC and PostgreSQL |
Date: | 2023-07-20 00:58:48 |
Message-ID: | 466555.1689814728@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Amn Ojee Uw <amnojeeuw(at)gmail(dot)com> writes:
> https://www.tutorialspoint.com/postgresql/postgresql_java.htm
> In reference to the above web page, it reads :
> The following Java code shows how to connect to an existing database. If
> the database does not exist, then it will be created and finally a
> database object will be returned.
> True, the database file does not exist, but isn't JDBC supposed to
> create it?
I think that web page is lying to you. JDBC cannot promise to
create a database for you, because (a) if the given database
doesn't exist, it would have to guess at some other database
to connect to, with no certainty of success; and (b) even if
it manages to connect to the server, there's no certainty
that you'd have permissions to create a new database.
So I don't believe any JDBC driver would even try.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Chuck Davis | 2023-07-20 01:11:44 | Re: My 1st JDBC and PostgreSQL |
Previous Message | Maciek Sakrejda | 2023-07-20 00:55:49 | Re: Nu-B here |