Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qMI0N-0022zJ-ES for pgsql-general@arkaria.postgresql.org; Thu, 20 Jul 2023 00:58:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qMI0L-00EADS-Qf for pgsql-general@arkaria.postgresql.org; Thu, 20 Jul 2023 00:58:53 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qMI0L-00EACa-GL for pgsql-general@lists.postgresql.org; Thu, 20 Jul 2023 00:58:53 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qMI0H-000XvE-Ni for pgsql-general@lists.postgresql.org; Thu, 20 Jul 2023 00:58:52 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 36K0wmSO466556; Wed, 19 Jul 2023 20:58:48 -0400 From: Tom Lane To: Amn Ojee Uw cc: pgsql-general@lists.postgresql.org Subject: Re: My 1st JDBC and PostgreSQL In-reply-to: References: Comments: In-reply-to Amn Ojee Uw message dated "Wed, 19 Jul 2023 20:37:07 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <466554.1689814728.1@sss.pgh.pa.us> Date: Wed, 19 Jul 2023 20:58:48 -0400 Message-ID: <466555.1689814728@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Amn Ojee Uw 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