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 1qMHfW-0022AO-1b for pgsql-general@arkaria.postgresql.org; Thu, 20 Jul 2023 00:37:21 +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 1qMHfU-00DfOS-GJ for pgsql-general@arkaria.postgresql.org; Thu, 20 Jul 2023 00:37:20 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qMHfU-00DfOK-67 for pgsql-general@lists.postgresql.org; Thu, 20 Jul 2023 00:37:20 +0000 Received: from mail-qk1-x732.google.com ([2607:f8b0:4864:20::732]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qMHfR-000P7b-JT for pgsql-general@lists.postgresql.org; Thu, 20 Jul 2023 00:37:18 +0000 Received: by mail-qk1-x732.google.com with SMTP id af79cd13be357-7672073e7b9so23999785a.0 for ; Wed, 19 Jul 2023 17:37:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689813436; x=1690418236; h=content-transfer-encoding:subject:to:content-language:user-agent :mime-version:date:message-id:from:from:to:cc:subject:date :message-id:reply-to; bh=41O3Az+lLyIehsoHodmEzWMIa7XuKurlponKqLWtA2I=; b=cRpJzNr1JAYaLrdwgftVBV5atMWH9Bu2IbAp50t+uqFZU+pGfgjaNrdjZJCQYjZTXZ CNZ0rosmc2TP+OMFX9spiG0gQlp09Cr9rytI3d5BxUCk+rEoxfI0p0nXP7ZdI6/7YKfn Q7P2L92mvJ0cXacO5C1+/+QJqrXHuHhOBq0ixLW4ywnBYgqgQBmzb+ASP9X3+aB7lBJ8 qwqnWphdjJdrNkxIOZeMLMPKmoPGyFBFeq8Ps5gOh/+lTMSP+1rOgQYJRs0JQWG5uqrF YIjp/j1M0iiXK6fw22AmGEjxTu/NBKEBi/XUQPcP+mh61pFARPkuaW5k9eo0JGRHUvUv OBZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689813436; x=1690418236; h=content-transfer-encoding:subject:to:content-language:user-agent :mime-version:date:message-id:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=41O3Az+lLyIehsoHodmEzWMIa7XuKurlponKqLWtA2I=; b=A+0FOch71rhtI0gMOXWbQ2PQxAr0f9J+hd8j8k8VNQ7zrjlFOeJicNRvI9K/XE7Cy9 X3Awm0C502dPuu6YOTg/6jE6uUhoKmou0twZP9ei6dmJ91sXCEwlqc2uTI3VCCpFZleO t5S/Bm4jeSCo/rFVcIDycvdjbUl65eI54+ZOhXDqdOH7g4ktchIZ959EM+XcC7uhboum 1RwlI7+/E+xerrOfyDSBxP41yPS7Q4lTUeZpz+67jkgkHAJ9AsNT4Sw5BPGwj1eP0krK gkopjyKoIN2MPh+93SjCyt2iBbTJryzqC1rfFOMXf88AHKXkdMwHdht3G6HTITP+CM61 NzZA== X-Gm-Message-State: ABy/qLbHUJA8MhbiK4M3kYtxEn5E0OHCSE9kiLyS1vkJ5IYC/3w9if2M FgcgohAI3MdbrACufMjDyIjwBbV6Aj9Waw== X-Google-Smtp-Source: APBJJlGuXJvIFzG7jVqrzU+/gCCxjrE1uLEFLYqr5cv611HmJFXD7eCJqpUOGB83afqBP7OgzgH81g== X-Received: by 2002:a05:620a:2415:b0:767:250d:f0a2 with SMTP id d21-20020a05620a241500b00767250df0a2mr21772364qkn.22.1689813436138; Wed, 19 Jul 2023 17:37:16 -0700 (PDT) Received: from [192.168.2.170] ([67.70.150.114]) by smtp.gmail.com with ESMTPSA id pa39-20020a05620a832700b007675c4b530fsm640350qkn.28.2023.07.19.17.37.15 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Jul 2023 17:37:15 -0700 (PDT) From: Amn Ojee Uw X-Google-Original-From: Amn Ojee Uw Message-ID: Date: Wed, 19 Jul 2023 20:37:07 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Content-Language: en-US To: pgsql-general@lists.postgresql.org Subject: My 1st JDBC and PostgreSQL Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Following the example in : https://www.tutorialspoint.com/postgresql/postgresql_java.htm I wrote the bellow method : public void connectToDatabase() throws ClassNotFoundException, SQLException {         try {             this.perr(this.getDatabaseClass()); // org.postgresql.Driver = Class             this.perr(this.getDatabaseUrl());   // jdbc:postgresql://localhost:5432/sara.pgdb = url             this.perr(this.getUserID());        // chispa = user             this.perr(this.getUserPassword());  // 8UUKZW = password             Class.forName(this.getDatabaseClass().toString());             conn = DriverManager.getConnection(this.getDatabaseUrl().toString(),                     this.getUserID().toString(),                     this.getUserPassword().toString() );         } catch (final SQLException | ClassNotFoundException e) {             throw e;         }     } However, it throws an exception that reads : Exception in thread "main" org.postgresql.util.PSQLException: FATAL: database "sara.pgdb" does not exist 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? Any help would be much appreciated.