Troubles using PreparedStatements - Mailing list pgsql-jdbc

From Alexander Troppmann
Subject Troubles using PreparedStatements
Date
Msg-id 200204192339.BAA16968@akira.globalinxs.de
Whole thread Raw
Responses Re: Troubles using PreparedStatements  (Dave Cramer <Dave@micro-automation.net>)
List pgsql-jdbc
Hello,

I ran into troubles when using PreparedStatements with JDBC. My PostgreSQL
version is postgresql-jdbc-7.1.3-2 from Red Hat Linux 7.2, JDK is
IBMJava2-SDK-1.3-9.0. Here is a code snippet - I've built in debuggings...

log.debug("use a PreparedStatement and set all values");
pstmt = conn.prepareStatement(sqlValue);
log.debug("before setValues");
setValues(pstmt, values);
log.debug("after setValues");
rs = pstmt.executeQuery();
log.debug("after executeQuery");

I've already debugged the setValues() method successfully (the "values"
Vector provided wrong Objects...) So the problem is: the last line of the
code snippet will never be reached. So here's my debugging output:

[DEBUG] SQLCommandBean - requesting connection from DataSource
[DEBUG] SQLCommandBean - use a PreparedStatement and set all values
[DEBUG] SQLCommandBean - before setValues
[DEBUG] SQLCommandBean - set 1 values for prepared statement
[DEBUG] SQLCommandBean - element 1:
hexagon.storage.sql.value.IntValue@3267de1b
[DEBUG] SQLCommandBean - all values set
[DEBUG] SQLCommandBean - after setValues

unfortunatly that's all - no Exception, no error, no message at all - it
seems that the "rs = pstmt.executeQuery();" statement kills the running java
process...

Any idea?

The sql query looks like this: SELECT p.id, c.name AS customername, p.title,
p.description, p.creation, p.modified FROM project AS p, customer AS c WHERE
p.customer_id=c.id AND p.id=? ORDER BY customer, title

This code line adds the value for the prepared statement in setValues():

...
} else if (v instanceof IntValue) {
   pstmt.setInt(j, v.getInt());
...

I hope, someone can help... :-))

greetings from Munich,
cu talex


--
Don't Fear the Penguin...        <o)
                                 /\\
> http://www.cocktaildreams.de  _\_v


pgsql-jdbc by date:

Previous
From: Tim Pizey
Date:
Subject: Melati 0.6.0 Released
Next
From: Dave Cramer
Date:
Subject: Re: Troubles using PreparedStatements