[Pljava-dev] After an insert, the trigger can't find the row

From: thhal at mailblocks(dot)com (Thomas Hallgren)
To:
Subject: [Pljava-dev] After an insert, the trigger can't find the row
Date: 2005-08-26 08:49:01
Message-ID: thhal-0/2/qA31T8LQI1RjDekVap8658G535A@mailblocks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

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
>

In response to

Browse pljava-dev by date

  From Date Subject
Next Message Eric BOYER 2005-08-30 14:45:27 [Pljava-dev] Can't have metadat info
Previous Message Eric BOYER 2005-08-26 08:24:38 [Pljava-dev] After an insert, the trigger can't find the row