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

From David G. Johnston
Subject Re: JDBC: ERROR: portal "C_2" does not exist
Date
Msg-id CAKFQuwYh56uwTpaPSf_Jp-_Kz9+vRbwBHVcHpHDJ=cVM20nTkQ@mail.gmail.com
Whole thread Raw
In response to Re: JDBC: ERROR: portal "C_2" does not exist  (Blake McBride <blake1024@gmail.com>)
Responses Re: JDBC: ERROR: portal "C_2" does not exist  (Blake McBride <blake1024@gmail.com>)
List pgsql-jdbc
On Fri, Mar 11, 2022 at 8:47 PM Blake McBride <blake1024@gmail.com> wrote:

conn.setAutoCommit(false)
PreparedStatement pstat = conn.prepareStatement(sql)
pstat.setFetchSize(50)
select all records in a large file
for each record:
        read one field from the record
        through a second statement, add a record to a different table - XXX
        execute the second statement - YYY
        commit the change - ZZZ
        loop

It seems I can do one or the other but not both - or can I?


Correct.  What you are trying to do requires that you open two sessions to the database (conn_read, conn_write) and execute the INSERT command on the conn_write connection while looping through data on the conn_read one.

David J.

pgsql-jdbc by date:

Previous
From: Blake McBride
Date:
Subject: Re: JDBC: ERROR: portal "C_2" does not exist
Next
From: Blake McBride
Date:
Subject: Re: JDBC: ERROR: portal "C_2" does not exist