agora inbox for pljava-dev@postgresql.org
help / color / mirror / Atom feed[Pljava-dev] Problem with jdbc driver
4+ messages / 0 participants
[nested] [flat]
* [Pljava-dev] Problem with jdbc driver
@ 2004-09-16 18:11
2004-09-16 19:19 ` [Pljava-dev] Problem with jdbc driver
2004-09-17 11:18 ` [Pljava-dev] Problem with jdbc driver
2004-09-17 14:32 ` [Pljava-dev] Problem with jdbc driver
0 siblings, 3 replies; 4+ messages in thread
From: @ 2004-09-16 18:11 UTC (permalink / raw)
I'm having problems when i try to call a function inside another one
using a SQL statement.
I change the driver and that works (slowest), but if I use the default
jdbc, i get an error: "the server closed unexpectedly"
Some one knows about that problem??
Some one have make it works with the default jdbc of pljava??
thanks
Daniel
^ permalink raw reply [nested|flat] 4+ messages in thread
* [Pljava-dev] Problem with jdbc driver
2004-09-16 18:11 [Pljava-dev] Problem with jdbc driver
@ 2004-09-16 19:19 `
2 siblings, 0 replies; 4+ messages in thread
From: @ 2004-09-16 19:19 UTC (permalink / raw)
daniel.ovalle wrote:
>I'm having problems when i try to call a function inside another one
>using a SQL statement.
>I change the driver and that works (slowest), but if I use the default
>jdbc, i get an error: "the server closed unexpectedly"
>
>Some one knows about that problem??
>Some one have make it works with the default jdbc of pljava??
>
>thanks
>
>Daniel
>
>
There shouldn't be a problem calling a function from within a function.
Do you have an example that I can look at?
Regards,
Thomas Hallgren
^ permalink raw reply [nested|flat] 4+ messages in thread
* [Pljava-dev] Problem with jdbc driver
2004-09-16 18:11 [Pljava-dev] Problem with jdbc driver
@ 2004-09-17 11:18 `
2 siblings, 0 replies; 4+ messages in thread
From: @ 2004-09-17 11:18 UTC (permalink / raw)
Daniel,
>My first function f1(Date, Date, int4) calls a java method in the class
>'my.package.prc.ActAtv' and returns a boolean. That works fine!!
>
>My second function f2() calls a java method in the class
>'my.package.prc.CrnAtv' and returns a boolean, but in my second class I
>have the next code:
>
>Connection _cn=DriverManager.getConnection("jdbc:default:connection");
>String _sql = "SELECT actity.uid WHERE f1($1,$2,activity.uid);
>Here I get the error!!
>
>
I have several examples running where I call SQL from within a Java
function and that SQL in turn calls other Java functions. They run
without any problem. In your example I see that you use '$1' and '$2' as
parameter placeholders instead of the '?' stipulated by JDBC. Could that
be your problem? The PL/Java driver will only recognize '?' . An attempt
to use your string would give an SQLException with 'Illegal parameter
index'.
In any case, it would be very helpful to know what the error is, what
platform you're using and what versions you have on PostgreSQL, PL/Java,
and Java.
Regards,
Thomas Hallgren
^ permalink raw reply [nested|flat] 4+ messages in thread
* [Pljava-dev] Problem with jdbc driver
2004-09-16 18:11 [Pljava-dev] Problem with jdbc driver
@ 2004-09-17 14:32 `
2 siblings, 0 replies; 4+ messages in thread
From: @ 2004-09-17 14:32 UTC (permalink / raw)
Daniel,
>I have a question, how much better is the performance of the functions
>if I use the GCJ???
>
>
That depends on what you're doing. It can range from worse to a lot
better. If you application creates lots of new connections, drops them,
and recreates them, the performance increase can be dramatic. Especially
if you declare the pljava shared object as a preloaded module. If a
connection pool is utilized, and if your functions execute a great deal
of code, you may actually get a performance decrease since the Sun JVM
has a more efficient interpreter and hotspot optimizer. At present, only
the pljava.jar is compiled into machine code when you use GCJ. Future
GCJ based versions of PL/Java will be able to compile the jars loaded
with install_jar() function as well.
If you're dependent on Java 1.5 you will have to wait a while before you
can use GCJ. At present it's a somewhat incomplete 1.4 version.
Since you bring up performance I get somewhat worried. If you are
experiencing bad performance, I'd really like to know when. Keep in mind
though, that using the *client* JDBC driver (the one found at
jdbc.postgresql.org) from within a PL/Java is something that I strongly
discourage. You will get severe performance penalties since a new
postgres process (and if a java function is called, a new JVM) is
spawned each time you establish a new connection. Further more, the new
connection is not attached to your session so it uses a completely
separate transaction. In contrast, The PL/Java internal JDBC driver
should show really good performance and execute within the callers
transaction.
Regards,
Thomas Hallgren
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2004-09-17 14:32 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-09-16 18:11 [Pljava-dev] Problem with jdbc driver
2004-09-16 19:19 `
2004-09-17 11:18 `
2004-09-17 14:32 `
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox