agora inbox for pljava-dev@postgresql.org
help / color / mirror / Atom feed[Pljava-dev] pljava + http-post
4+ messages / 0 participants
[nested] [flat]
* [Pljava-dev] pljava + http-post
@ 2007-10-20 16:36
2007-10-22 07:25 ` [Pljava-dev] pljava + http-post
0 siblings, 1 reply; 4+ messages in thread
From: @ 2007-10-20 16:36 UTC (permalink / raw)
Hello evrybody,
i'm quite new to both postgresql and pljava and thus i'm having some problems to make my pljava function work.
I've a table with a trigger on it that call my pljava function. The function do some queries using the pljava jdbc and finally POST some data to a jsp page running on a resin webserver that is on the same pc where the postgresql db is running. The jsp page itself just read the data and insert it into another table on the same db.
I've tested the jsp page using another html page that pass the data through a form and it get inserted correctly into the db.
The trigger function seems to work correctly because i print(insert) some debug lines into a debug-table and the execution flow is correct.
To post my data from the trigger function i use this piece of code :
URL url = new URL("http://localhost:8080/catchxml/prova.jsp";);
HttpURLConnection urlcon = (HttpURLConnection)url.openConnection();
urlcon.setDoOutput(true);
urlcon.setDoInput(false);
urlcon.setUseCaches(false);
urlcon.setRequestMethod("POST");
urlcon.setRequestProperty("Content-length", String.valueOf(data.length()));
OutputStreamWriter wr = new OutputStreamWriter(urlcon.getOutputStream());
wr.write(data);
wr.flush();
everything wrapped in a try/catch block that printout any generic exception.
It seems to work, because if the webserver isnt running i get an exception while trying to create the httpconnection. But, even if the write/flush doesnt give any error, my jsp page doesnt recive any data.
I also tryed to use the javau statement but nothing changed.
Any suggestion ?
I could really use some help.
________________________________________________________________________
SERVIZIO VOICE: TELEFONA e INVIA SMS dal tuo computer a tariffe vantaggiose!
Scopri come telefonare e videochiamare gratis da pc a pc.
http://voice.repubblica.it
^ permalink raw reply [nested|flat] 4+ messages in thread
* [Pljava-dev] pljava + http-post
2007-10-20 16:36 [Pljava-dev] pljava + http-post
@ 2007-10-22 07:25 `
2007-10-22 12:54 ` [Pljava-dev] pljava + http-post
0 siblings, 1 reply; 4+ messages in thread
From: @ 2007-10-22 07:25 UTC (permalink / raw)
On Sat, 20 Oct 2007, mechwarrior at katamail.com wrote:
> i'm quite new to both postgresql and pljava and thus i'm having some
> problems to make my pljava function work.
>
I don't see anything pljava specific here. Does this work if you run it
as a standalone application?
Kris Jurka
^ permalink raw reply [nested|flat] 4+ messages in thread
* [Pljava-dev] pljava + http-post
2007-10-20 16:36 [Pljava-dev] pljava + http-post
2007-10-22 07:25 ` [Pljava-dev] pljava + http-post
@ 2007-10-22 12:54 `
2007-10-22 21:07 ` [Pljava-dev] pljava + http-post
0 siblings, 1 reply; 4+ messages in thread
From: @ 2007-10-22 12:54 UTC (permalink / raw)
> Da: Kris Jurka <books at ejurka.com>
> Data: Mon, 22 Oct 2007 03:25:50 -0400 (EDT)
> A: "mechwarrior at katamail.com" <mechwarrior at katamail.com>
> Oggetto: Re: [Pljava-dev] pljava + http-post
>
>
>
> On Sat, 20 Oct 2007, mechwarrior at katamail.com wrote:
>
> > i'm quite new to both postgresql and pljava and thus i'm having some
> > problems to make my pljava function work.
> >
>
> I don't see anything pljava specific here. Does this work if you run it
> as a standalone application?
>
> Kris Jurka
>
My bad ... i trusted too much the many examples and tutorial about sending POST data through java apps that getting no exception meant "everything works fine", to me. As you suggested, tryed a standalone java app to do the same "post" work and got the same result.
In the end i made it, and now everything works as intended but, there are two strange behaviors i cant explain.
1) Java http-post works fine with a servlet but not with a jsp page
2) Since each time i modify my pljava function i've to compile+jar and then replace the jar in the db, i made (atleast for the second part) a function with about 10 commands (same as pljava exmaple tutorial + cleaning some debug tables). Sometimes happen that even if i execute my function the jar dont get updated and i've to restart the postgres db. That's quite annoying if you're trying to understand if you're making useless updates to your code or if it's just postgres not updating the new jar.
Anyway thx again for the support even if not so pljava related.
________________________________________________________________________
SERVIZIO VOICE: TELEFONA e INVIA SMS dal tuo computer a tariffe vantaggiose!
Scopri come telefonare e videochiamare gratis da pc a pc.
http://voice.repubblica.it
^ permalink raw reply [nested|flat] 4+ messages in thread
* [Pljava-dev] pljava + http-post
2007-10-20 16:36 [Pljava-dev] pljava + http-post
2007-10-22 07:25 ` [Pljava-dev] pljava + http-post
2007-10-22 12:54 ` [Pljava-dev] pljava + http-post
@ 2007-10-22 21:07 `
0 siblings, 0 replies; 4+ messages in thread
From: @ 2007-10-22 21:07 UTC (permalink / raw)
mechwarrior at katamail.com wrote:
> 2) Since each time i modify my pljava function i've to compile+jar and then replace the jar in the db, i made (atleast for the second part) a function with about 10 commands (same as pljava exmaple tutorial + cleaning some debug tables). Sometimes happen that even if i execute my function the jar dont get updated and i've to restart the postgres db. That's quite annoying if you're trying to understand if you're making useless updates to your code or if it's just postgres not updating the new jar.
>
The jar is updated but the classes that the JVM already has loaded into
memory are not replaced. Compare to having a running JVM and replacing
jar files on the disk. Even if those files are on the a classpath seen
by a JVM, no "hot replace" would take place.
Regards,
Thomas Hallgren
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2007-10-22 21:07 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-10-20 16:36 [Pljava-dev] pljava + http-post
2007-10-22 07:25 `
2007-10-22 12:54 `
2007-10-22 21:07 `
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox