pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Amn Ojee Uw <amnojeeuw@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: My 1st JDBC and PostgreSQL
Date: Wed, 19 Jul 2023 20:58:48 -0400
Message-ID: <466555.1689814728@sss.pgh.pa.us> (raw)
In-Reply-To: <b7689ed5-773b-03ad-5f8c-5f18c97bafc3@gmail.com>
References: <b7689ed5-773b-03ad-5f8c-5f18c97bafc3@gmail.com>

Amn Ojee Uw <amnojeeuw@gmail.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





view thread (7+ messages)  latest in thread

Message-ID: <466555.1689814728@sss.pgh.pa.us>
Permalink:  ../466555.1689814728@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/466555.1689814728@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, amnojeeuw@gmail.com
  Subject: Re: My 1st JDBC and PostgreSQL
  In-Reply-To: <466555.1689814728@sss.pgh.pa.us>
  References: <b7689ed5-773b-03ad-5f8c-5f18c97bafc3@gmail.com> <466555.1689814728@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox