agora inbox for pljava-dev@postgresql.org  
help / color / mirror / Atom feed
[Pljava-dev] NPE using existing TriggerData ResultSet
2+ messages / 0 participants
[nested] [flat]

* [Pljava-dev] NPE using existing TriggerData ResultSet
@ 2005-10-03 01:38  
  0 siblings, 1 reply; 2+ messages in thread

From:  @ 2005-10-03 01:38 UTC (permalink / raw)

Hi,

I was trying to use the existing postgresql connection from TriggerData 
in Trigger function trying to write some data back to postgresql (in 
another table) by using:

public static void triggerFunction(TriggerData td)
{
  .
  ResultSet _rsnew = td.getNew();
  .
  .
  .
  function(_rsnew.getStatement().getConnection());   //<========= (NPE here)
  .
  .
}


private static function (java.sql.Connection conn)
{
  .
  .
  .
}

However, I am getting NPE at statement 
"_renew.getStatement().getConnection()".

Is this a bug? Do you have another solution to reuse existing postgresql 
connection?

Thanks a lot for helping.

Regards,
Kong




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* [Pljava-dev] NPE using existing TriggerData ResultSet
@ 2005-10-03 05:25  
  parent: 
  0 siblings, 0 replies; 2+ messages in thread

From:  @ 2005-10-03 05:25 UTC (permalink / raw)

No, that's not a bug. There's no statement associated with the ResultSet 
obtained from TriggerData. The statement:

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

will always return the current (i.e. the existing postgresql) connection.

- thomas

kstian wrote:

> Hi,
>
> I was trying to use the existing postgresql connection from 
> TriggerData in Trigger function trying to write some data back to 
> postgresql (in another table) by using:
>
> public static void triggerFunction(TriggerData td)
> {
>  .
>  ResultSet _rsnew = td.getNew();
>  .
>  .
>  .
>  function(_rsnew.getStatement().getConnection());   //<========= (NPE 
> here)
>  .
>  .
> }
>
>
> private static function (java.sql.Connection conn)
> {
>  .
>  .
>  .
> }
>
> However, I am getting NPE at statement 
> "_renew.getStatement().getConnection()".
>
> Is this a bug? Do you have another solution to reuse existing 
> postgresql connection?
>
> Thanks a lot for helping.
>
> Regards,
> Kong
> _______________________________________________
> Pljava-dev mailing list
> Pljava-dev at gborg.postgresql.org
> http://gborg.postgresql.org/mailman/listinfo/pljava-dev







^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2005-10-03 05:25 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-10-03 01:38 [Pljava-dev] NPE using existing TriggerData ResultSet 
2005-10-03 05:25 ` 

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