From: | johann at 2ndquadrant(dot)com (Johann 'Myrkraverk' Oskarsson) |
---|---|
To: | |
Subject: | [Pljava-dev] null pointer exception in pl/java jdbc driver |
Date: | 2012-05-24 09:07:43 |
Message-ID: | oby4pb.x5oby4pb.wr42.7xr4.gnus@asuka.myrkraverk.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pljava-dev |
"Welty, Richard" <rwelty at ltionline.com> writes:
> i'm having trouble chasing down what may be close to the last bug in
> my pl/ java code, a null pointer when executing an update. are there
> restrictions on what i can do inside a function with this jdbc driver?
> at this point, the code has successfully done a select, found the rows
> it wants and issued an http request to a solr search engine; now it
> needs to delete the rows that triggered the successful update:
>
> the method:
The following code works for me. Can you give us the steps you are
taking?
package com2ndQuadrant.pljava;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.SQLException;
import java.util.List;
import java.util.LinkedList;
import java.util.logging.Logger;
public class Update
{
public static void delete( Connection c,
String key,
List< Integer > ids )
throws SQLException
{
String s = ids.toString();
s = s.substring( 1, s.length() - 1 );
Logger l = Logger.getAnonymousLogger();
l.fine( s );
String r = "delete from t where key = '"
+ key
+ "' and id in ( " + s + " ) ";
l.fine( r );
Statement stm = c.createStatement();
stm.execute( r );
}
public static void doStuff( String key )
throws SQLException
{
Connection c = DriverManager.getConnection
( "jdbc:default:connection" );
List< Integer > l = new LinkedList< Integer >();
l.add( 3 );
l.add( 5 );
l.add( 7 );
delete( c, key, l );
}
}
--
Johann Oskarsson http://www.2ndquadrant.com/ |[]
PostgreSQL Development, 24x7 Support, Training and Services --+--
|
Blog: http://my.opera.com/myrkraverk/blog/
From | Date | Subject | |
---|---|---|---|
Next Message | Welty, Richard | 2012-05-24 13:44:21 | [Pljava-dev] null pointer exception in pl/java jdbc driver |
Previous Message | David Gradwell | 2012-05-24 08:11:56 | [Pljava-dev] PL/Java 64bit - The specified procedure could not be found. |