Re: How different is AWS-RDS postgres?

Rob Sargent <robjsargent@gmail.com>

From: Rob Sargent <robjsargent@gmail.com>
To: Sam Gendler <sgendler@ideasculptor.com>
Cc: Philip Semanchuk <philip@americanefficient.com>, Ian Harding <harding.ian@gmail.com>, Ron <ronljohnsonjr@gmail.com>, "pgsql-generallists.postgresql.org" <pgsql-general@lists.postgresql.org>
Date: 2021-05-27T22:35:41Z
Lists: pgsql-general
On 5/27/21 4:25 PM, Sam Gendler wrote:
> That sure looks like something is causing your connection to have a 
> transaction rollback.  I haven't worked in Java in far too long, but 
> it seems like your connection pool is under the impression your 
> connection was abandoned so it reclaims it and rollback the 
> transaction, which would explain why you aren't seeing the table when 
> all is said and done - all of the work is being undone at the end.
>
> One possibility, based on the catalina log you provided - if you have 
> either end of the connection set up to automatically close idle 
> connections after a period of time, then you might receive a closed 
> connection from the pool, which will just error out when you attempt 
> to run a query. In which case, you need to set up your connection pool 
> to test a connection before it returns it to the requester.  Usually 
> something as simple as "select 2" will be sufficient to determine if 
> the database connection is open. I can just about guarantee that your 
> connection pool has a parameter which allows you to specify a query to 
> execute when a connection is requested.
>

Well I /was/ doing

    contextResource.setProperty("validationQuery", "SELECT 1");

but I see that I lost that when I switched to using a properties file.  
Thanks for point me there.

The loop of 16 insert statement is in a single transaction, single 
connection so I'm not sure who's choking first.  Is the connection idle 
after the I/O error or is the I/O error from a dead connection?  (Small 
disclaimer:  there is no catalina involved here, just an embedded tomcat 
instance.)