Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1itKu8-0006hy-Jx for pgsql-admin@arkaria.postgresql.org; Mon, 20 Jan 2020 00:26:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1itKu7-00071t-5u for pgsql-admin@arkaria.postgresql.org; Mon, 20 Jan 2020 00:26:55 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1itKu6-0006zp-D8 for pgsql-admin@lists.postgresql.org; Mon, 20 Jan 2020 00:26:54 +0000 Received: from sonic301-29.consmr.mail.bf2.yahoo.com ([74.6.129.228]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1itKu3-0002lO-9R for pgsql-admin@lists.postgresql.org; Mon, 20 Jan 2020 00:26:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1579480008; bh=cXxNbCnZ/l91ChYDVAlalK6hg3dnRQpxyFIjXe31hLo=; h=To:From:Subject:Date:References:From:Subject; b=o3lvQ8yz1q19zBi8cPevEklDGONRL1Jbat+33t3ykv2SqYsgwYTLVbbJMEiZRHDO0OxQfnEeCKH6jZK2L7ezRNvE6IqpkJQbjuZoMHtIMAKWn+/mBOAkghxXxdM6KNgqYR8u+Ne/sEkP2WVIOLHdNAC0mH3sLEzyCv0MQWFwzJzwSCjBQHhJM4151sBZPt1rX53wtjw9rhF6bpIU44lgPOTtqm++0tteCV/pK0jgyoQ4/XZj5winFyUWF5bsK2YQxcnk1rURA3A31uepGFfCELMX3m7uhS11035c7KoqaNbSO/O08C+fcUcW6VDOuYO3q1XTx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TNjtY0kY.X6eL0DDmU YJMWOhNfMUVQ1MQ7I21bCEc6ahDdvZp7GU2iDnEyaCpwFSRouS2zL4AlXcHgjJ63_uF2g7hjmhJ4 Tj6t48XBlJ74qJR3Rz3cBtld6L.jnJg_Uh8E787orS6M4C3nolGvD_63YppN4wYxBK01.phmRpOy 7u2BlJv25HUwsafWJ7tAZ3o0tLMNOWsQ._997cBRiZjbPNCj2itaR_SVS4REOHE3HXx3NcCpcIgr skJSYGSXs4vGqujXp3bifl4SxCPHuW4diOXfv83EzvT8fx2sdNceJ5LRLeOG7SF3O5bMorq_CrQm 3sdJML9eRyUH7hfOsS.l.9OfqCVatYW5Hd2DB Received: from sonic.gate.mail.ne1.yahoo.com by sonic301.consmr.mail.bf2.yahoo.com with HTTP; Mon, 20 Jan 2020 00:26:48 +0000 Received: by smtp413.mail.ne1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 354138da49294a89c8d4a062a098ac15; Mon, 20 Jan 2020 00:24:47 +0000 (UTC) To: pgsql-admin@lists.postgresql.org From: CR20 Subject: Ver. 12.1 successfully installed on Win 10 but having trouble with jdbc jar Message-ID: <7d2f92c9-a779-832b-849e-a38f929375d6@yahoo.com> Date: Sun, 19 Jan 2020 19:24:40 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------------33C3D2B39908E4E604CBBAFC" Content-Language: en-US References: <7d2f92c9-a779-832b-849e-a38f929375d6.ref@yahoo.com> X-Mailer: WebService/1.1.14873 hermes Apache-HttpAsyncClient/4.1.4 (Java/1.8.0_181) Content-Length: 4732 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------33C3D2B39908E4E604CBBAFC Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Hi, I have postgresql-12.1-3-windows-x64 installed and apparently working, but I'm then I'm trying a simple Java connection example as follows: import java.sql.*; public class CreateTable {     public static void main(String args[]) {         Connection c = null;         Statement stmt = null;         String CreateSql = null;         try {             Class.forName("org.postgresql.Driver");             c = DriverManager.getConnection("jdbc:postgresql://localhost:5432/procedure_demo", "postgres", "adminedb");             System.out.println("Database Connected ..");             stmt = c.createStatement();             CreateSql = "Create Table Test(id int primary key, name varchar, address text) ";             stmt.executeUpdate(CreateSql);             stmt.close();             c.close();         }         catch (Exception e) {             System.err.println( e.getClass().getName()+": "+ e.getMessage() );             System.exit(0);         }         System.out.println("Table Created successfully");     } } ...which compiled successfully but when I go to run it, with postgresql-42.2.9.jar stored in path C:\PostgreSQL\libs, like as follows: java -cp C:\PostgreSQL\libs . CreateTable ...the command line returns: Error: Could not find or load main class . Some of this is my limited knowledge of Java.  My question then is, Where should the jdbc jar be located in order to run, and then how do I run all this at the command line?  Thank you for any help. --------------33C3D2B39908E4E604CBBAFC Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit

Hi,

I have postgresql-12.1-3-windows-x64 installed and apparently working, but I'm then I'm trying a simple Java connection example as follows:

import java.sql.*;

public class CreateTable {
    public static void main(String args[]) {
        Connection c = null;
        Statement stmt = null;
        String CreateSql = null;

        try {
            Class.forName("org.postgresql.Driver");
            c = DriverManager.getConnection("jdbc:postgresql://localhost:5432/procedure_demo", "postgres", "adminedb");
            System.out.println("Database Connected ..");
            stmt = c.createStatement();   
            CreateSql = "Create Table Test(id int primary key, name varchar, address text) ";
            stmt.executeUpdate(CreateSql);
            stmt.close();
            c.close();
        }

        catch (Exception e) {
            System.err.println( e.getClass().getName()+": "+ e.getMessage() );
            System.exit(0);
        }

        System.out.println("Table Created successfully");
    }
}

...which compiled successfully but when I go to run it, with postgresql-42.2.9.jar stored in path C:\PostgreSQL\libs, like as follows:

java -cp C:\PostgreSQL\libs . CreateTable

...the command line returns:

Error: Could not find or load main class .

Some of this is my limited knowledge of Java.  My question then is, Where should the jdbc jar be located in order to run, and then how do I run all this at the command line?  Thank you for any help.

--------------33C3D2B39908E4E604CBBAFC--