Lists: | pljava-dev |
---|
From: | kongsen(dot)tian at tokuii(dot)com (kstian) |
---|---|
To: | |
Subject: | [Pljava-dev] NPE using existing TriggerData ResultSet |
Date: | 2005-10-03 01:38:25 |
Message-ID: | 43408B91.1080509@tokuii.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pljava-dev |
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
From: | thhal at mailblocks(dot)com (Thomas Hallgren) |
---|---|
To: | |
Subject: | [Pljava-dev] NPE using existing TriggerData ResultSet |
Date: | 2005-10-03 05:25:04 |
Message-ID: | thhal-0NlkcBPu/8bQY+jtLwtI5eEtvnV7lQ4@mailblocks.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pljava-dev |
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