Re: JDBC: ERROR: portal "C_2" does not exist - Mailing list pgsql-jdbc

From Blake McBride
Subject Re: JDBC: ERROR: portal "C_2" does not exist
Date
Msg-id CABwHSOuRkWDqx=Huwf5ZWc363fcNsW=Sw1kwEOj1JWP1znfwQA@mail.gmail.com
Whole thread Raw
In response to Re: JDBC: ERROR: portal "C_2" does not exist  (Sehrope Sarkuni <sehrope@jackdb.com>)
Responses Re: JDBC: ERROR: portal "C_2" does not exist  (Vladimir Sitnikov <sitnikov.vladimir@gmail.com>)
Re: JDBC: ERROR: portal "C_2" does not exist  (Blake McBride <blake1024@gmail.com>)
List pgsql-jdbc
Thank you for the info, Sehrope!

I checked. I am not closing anything.  However, I am using C3P0.  Perhaps that is configured wrong.  I'll look there.  Just knowing it should work is a big help.

It is hard for me to give a sample because it is part of a larger system and I am using utilities in that system rather than raw JDBC.  However, I am the author of those utilities so it's not a blackbox.  (They're at https://github.com/blakemcbride/Kiss)

Thank you!

Blake



On Fri, Mar 11, 2022 at 1:04 PM Sehrope Sarkuni <sehrope@jackdb.com> wrote:
When auto commit is diabled and using a non-zero fetch size, the pgjdbc driver creates a portal to read the query results from the server in chunks of fetch size. The portals have a string identifier and the driver generates them sequentially per connection with a "C_" prefix, so "C_1", "C_2", "C_3", ... etc.

As you read results via ResultSet.next(), the driver checks if it has the next row already buffered. If not, it reads from the named portal to retrieve the next chunk of fetchSize quantity of rows.

A fetch size of 50 and the error happening at row 51 likely means that something either closed the portal or the connection itself is not correct.

Are you using a connection pool like pgbouncer in between your Java application and the database server?

If so, the connection pooler must be transaction aware to ensure that the same connection is used throughout the entire transaction.

If not, try creating a minimal example that reproduces the error.

Regards,
-- Sehrope Sarkuni
Founder & CEO | JackDB, Inc. | https://www.jackdb.com/


 

pgsql-jdbc by date:

Previous
From: Dave Cramer
Date:
Subject: Re: JDBC: ERROR: portal "C_2" does not exist
Next
From: Vladimir Sitnikov
Date:
Subject: Re: JDBC: ERROR: portal "C_2" does not exist