Troubles using PreparedStatements

From: Alexander Troppmann <talex(at)karyopse(dot)de>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Troubles using PreparedStatements
Date: 2002-04-19 19:39:22
Message-ID: 200204192339.BAA16968@akira.globalinxs.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)storage(dot)sql(dot)value(dot)IntValue(at)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

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Barry Lind 2002-04-19 19:49:38 Re: Fastest method to insert data.
Previous Message Sam Varshavchik 2002-04-19 19:13:29 Fastest method to insert data.