Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kdIJq-00079V-Cd for pgsql-jdbc@arkaria.postgresql.org; Thu, 12 Nov 2020 19:31:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kdIJp-0002Tj-9w for pgsql-jdbc@arkaria.postgresql.org; Thu, 12 Nov 2020 19:31:41 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kdIJp-0002Tc-0i for pgsql-jdbc@lists.postgresql.org; Thu, 12 Nov 2020 19:31:41 +0000 Received: from mail-io1-xd2b.google.com ([2607:f8b0:4864:20::d2b]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kdIJm-00045E-3n for pgsql-jdbc@lists.postgresql.org; Thu, 12 Nov 2020 19:31:40 +0000 Received: by mail-io1-xd2b.google.com with SMTP id p7so7275038ioo.6 for ; Thu, 12 Nov 2020 11:31:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=slUpkX55X9g0dzISLGFij02BivxmwX0gmQWzx/gDNx8=; b=q5fNYVA8sbZ1BfrqYUehvcQyLx3/CDyGCeVkqGgnfFr3yQUF+iLw/3GJI+9mQkvj0z aT2nFLGfeYyLT12m2qtutwfrx618TzSZGFN5sWn3o0kK+aFeOJBUwAO8fsnAXAonKNY/ W6Z25JZYlzX6HvkQueIu9IVQUxRB2VXfq0SnF6KMxPbDcUnVa1/UiAKncwt9LJjL2i/z fiI+vNWB+PYOPAoRX48LP+gDlJTQDxi3TZqXfppSvnHWpgbGYfzLXG760pk6+QbJYuBT t8hGai+SwfSqMHMwnpL+StJdeOU7s9zyzxbAOPQpQLUrG4KHAgHkwbdaaHpsJse27YgK 0qHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=slUpkX55X9g0dzISLGFij02BivxmwX0gmQWzx/gDNx8=; b=aRMVArb/k+BkV80616QTm/QApRA9K+nldcQ1lCiLqqVTKBqtVjcbvvA3e+K/uK8mru Bm3NzdSdsoF0H078w9cl5k1Xxxc8r5OAtGr15HX2AyGuyXjE53bOB28sw6xJ0LwtIKo0 /xRC0Vgc7x9LR3hxAEZwmhn5ci8kx4EPcyE3EXO3ZcD9cS1Re8+pkDYUjMhVblteaywg Fv1RrUbEtSCIb8GUEsY/IjXz/IQFFd5AjWrk1MXbg3yB5kbkOV9W3UanCwj6jUIpcZZq Oh6lm3Px5cHIpbExnHIvdYPJ+gFee8a/nwQ7A2mx73OlzbS8ORhZozJDB1A/AdLOPYv2 sffA== X-Gm-Message-State: AOAM533XVFcKOoOKXAawxiMb4T3svdQrphWH+F1Hhhp0j1lbdGVRCX5l veGRoggwYEm2hAcQ04TQ8oN/3zt885s= X-Google-Smtp-Source: ABdhPJxU9J78bBSlPgVopGDlYfWWGAD9W24tWCnJjtW4S99IZQsXLTHmmuyYcHrieZMMFjeLhzDp0A== X-Received: by 2002:a02:cd39:: with SMTP id h25mr1070891jaq.144.1605209496094; Thu, 12 Nov 2020 11:31:36 -0800 (PST) Received: from ?IPv6:2601:681:5500:dde0:6506:16e0:7471:931? ([2601:681:5500:dde0:6506:16e0:7471:931]) by smtp.gmail.com with ESMTPSA id d142sm3292146iof.43.2020.11.12.11.31.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Nov 2020 11:31:35 -0800 (PST) Subject: Re: first connection attempt always fails, subsequent always succeed To: David Gradwell , "pgsql-jdbc@lists.postgresql.org" References: <98039f46-ab40-2c79-7620-3fa35ecb9869@gmail.com> <83C25F63-72BD-484F-94F4-11D996E759D2@gradwell.com> From: Rob Sargent Message-ID: <1239978e-d9bc-26d4-23f4-79009462cbae@gmail.com> Date: Thu, 12 Nov 2020 12:31:34 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <83C25F63-72BD-484F-94F4-11D996E759D2@gradwell.com> Content-Type: multipart/alternative; boundary="------------4F8FCB602766AA5E054347C6" Content-Language: en-CA List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------4F8FCB602766AA5E054347C6 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 11/12/20 12:11 PM, David Gradwell wrote: > > Rob, > > If this is obvious apologies, but have you explicitly included an > appropriate JDBC driver in your .war build ? > https://jdbc.postgresql.org/download.html I am currently fighting > issues with MacOS apparently not allowing connections to be made > (timeout or host not found) and have reverted to a 9.3 build for testing. > > Are you using NetBeans  as your IDE ? > > David Gradwell > > *From: *Rob Sargent > *Date: *Thursday, 12 November 2020 at 18:59 > *To: *"pgsql-jdbc@lists.postgresql.org" > *Subject: *first connection attempt always fails, subsequent always > succeed > > This is an embedded tomcat application, not full-blown apache server.  > Works great when it does...  I haven't wired in a connection supplier > yet since (for now) there are few clients and they do two reads and > one write, all very large. > > java: > > java -version > openjdk version "11.0.9" 2020-10-20 > OpenJDK Runtime Environment (build 11.0.9+11-Ubuntu-0ubuntu1.20.04) > OpenJDK 64-Bit Server VM (build 11.0.9+11-Ubuntu-0ubuntu1.20.04, > mixed mode, sharing) > > tomcat: > > version 9.0.39 > > poostgres: > > PostgreSQL 12.4 > > This is the servlet's connection code: > > String templateUrl = > System./getProperty/("SGSSVR_databaseConnection", > "jdbc:postgresql://%s/%s"); ///host(with :port) / dbname/ > > String fullurl = String./format/(templateUrl, dbhost, dbname);  > //will add port to this next > > conn = DriverManager./getConnection/(fullurl, dbrole, magicPassword); > > dsl = DSL./using/(conn, SQLDialect./POSTGRES/); > > which generates this stack trace, showing what looks to me like a good > url (and which works later). > > java.sql.SQLException: No suitable driver found for > jdbc:postgresql://localhost/version4007 >     at > java.sql/java.sql.DriverManager.getConnection(DriverManager.java:702) > thinking these forums like bottom posting From my war file (which I explode) WEB-INF/lib/postgresql-42.2.18.jar I get the same behaviour running from within IntelliJ and from gradle/command-line, on ubuntu 20.04 --------------4F8FCB602766AA5E054347C6 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit


On 11/12/20 12:11 PM, David Gradwell wrote:

Rob,

 

If this is obvious apologies, but have you explicitly included an appropriate JDBC driver in your .war build ?  https://jdbc.postgresql.org/download.html   I am currently fighting issues with MacOS apparently not allowing connections to be made (timeout or host not found) and have reverted to a 9.3 build for testing.

 

Are you using NetBeans  as your IDE ?

 

David Gradwell

 

From: Rob Sargent <robjsargent@gmail.com>
Date: Thursday, 12 November 2020 at 18:59
To: "pgsql-jdbc@lists.postgresql.org" <pgsql-jdbc@lists.postgresql.org>
Subject: first connection attempt always fails, subsequent always succeed

 

This is an embedded tomcat application, not full-blown apache server.  Works great when it does...  I haven't wired in a connection supplier yet since (for now) there are few clients and they do two reads and one write, all very large.

java:

java -version
openjdk version "11.0.9" 2020-10-20
OpenJDK Runtime Environment (build 11.0.9+11-Ubuntu-0ubuntu1.20.04)
OpenJDK 64-Bit Server VM (build 11.0.9+11-Ubuntu-0ubuntu1.20.04, mixed mode, sharing)

tomcat: 

version 9.0.39

poostgres:

PostgreSQL 12.4

This is the servlet's connection code:

String templateUrl = System.getProperty("SGSSVR_databaseConnection", "jdbc:postgresql://%s/%s"); //host(with :port) / dbname
String fullurl = String.format(templateUrl, dbhost, dbname);  //will add port to this next
conn = DriverManager.getConnection(fullurl, dbrole, magicPassword);
dsl = DSL.using(conn, SQLDialect.POSTGRES);

which generates this stack trace, showing what looks to me like a good url (and which works later).

java.sql.SQLException: No suitable driver found for jdbc:postgresql://localhost/version4007
    at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:702)

thinking these forums like bottom posting

From my war file (which I explode)

WEB-INF/lib/postgresql-42.2.18.jar

I get the same behaviour running from within IntelliJ and from gradle/command-line, on ubuntu 20.04


 

--------------4F8FCB602766AA5E054347C6--