pg.ddx.io  pljava-dev@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Subject: [Pljava-dev] After an insert, the trigger can't find the row
Date: Fri, 26 Aug 2005 10:49:01 +0200
Message-ID: <thhal-0/2/qA31T8LQI1RjDekVap8658G535A@mailblocks.com> (raw)
In-Reply-To: <430ED608.7010907@insa-toulouse.fr>
References: <430ED1C6.10603@insa-toulouse.fr>
	<430ED3DC.6000403@mailblocks.com>
	<thhal-0XmzqA3VT8LQ7/Onf4qDwCyhxE73gFZ@mailblocks.com>
	<430ED608.7010907@insa-toulouse.fr>
	<430ED77D.5050900@mailblocks.com>
	<thhal-0/2/qA3tT8LQ/6TOsO5w6H/8n28VlWu@mailblocks.com>

Eric BOYER wrote:

> String url="jdbc:postgresql://localhost:5432/bertha";
> Connection con = DriverManager.getConnection(url,"login","password");
> Statement select = con.createStatement();

Ok, that's what I suspected. You establish a whole new session to 
another postgresql backend. That session is not in anyway related to 
your ongoing transaction, that's why you don't see the changes. The 
correct way to obtain a connection is:

  Connection conn = DriverManager.getConnection("jdbc:default:connection");

That gives you the *current* connection, i.e. the one where your outer 
statement that caused the trigger was fired.

Another tip:
Somehow you make jar file for the PostgreSQL client jdbc driver 
available to PL/Java, either you loaded it using sqlj.install_jar or 
you've added it to a classpath somewhere. It should be removed altogether.

Regards,
Thomas Hallgren

>
> --------
>
> another test :
>
> In my bd :
> insert into exploitation.goupe values (170,'a','b');
>
> in my log with a select * from exploitation.goupe where 
> gid_number=170, the row is not in my db.
>
> in my bd again :
> insert into exploitation.goupe values (171,'c','d');
> in my class file (so int the log) with a
> select * from exploitation.groupe where gid_number=170, the row is 
> great in the db
> but with a
> select * from exploitation.groupe where gid_number=171, the row is not 
> in the db
>
>
> At the end of the execution of the trigger, in my psql command the 
> "select * from exploitation.groupe where gid_number=171" find the row !
>
> Eric
>






view thread (2+ messages)

Message-ID: <thhal-0/2/qA31T8LQI1RjDekVap8658G535A@mailblocks.com>
Permalink:  ../thhal-0%2F2%2FqA31T8LQI1RjDekVap8658G535A@mailblocks.com/
Also on:    postgresql.org/message-id/thhal-0/2/qA31T8LQI1RjDekVap8658G535A@mailblocks.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pljava-dev@postgresql.org
  Subject: Re: [Pljava-dev] After an insert, the trigger can't find the row
  In-Reply-To: <thhal-0/2/qA31T8LQI1RjDekVap8658G535A@mailblocks.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox