From: RichT <rricht@pacbell.net>
To: pgsql-jdbc@postgresql.org
Subject: Problem with string parameters
Date: 24 Mar 2007 12:35:46 -0700
Message-ID: <1174764946.377183.140290@y80g2000hsf.googlegroups.com> (raw)
Can anyone help with this?
I am using Postgres 7.4.13 JDBC interface and I get
"PSQLException: Parameter index out of range."
The query is:
INSERT INTO shm_log_sources
SELECT ? as name, ci.source_id, true as active, true as monitor,
0 as alerts_sent, '' as comment
FROM shm_current_ids ci LEFT OUTER JOIN shm_log_sources ls
ON ci.source_id = ls.source_id AND ls.name = ?
WHERE ls.active IS NULL
The code does
pStmt = conn.prepareStatement(query);
pStmt.clearParameters();
...
int paramNo = 1;
pStmt.setString(paramNo, monitorName);
...
paramNo++;
pStmt.setString(paramNo, monitorName);
Where monitorName is the String "SourceHealth"
Why do I get the exception?
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: rricht@pacbell.net
Subject: Re: Problem with string parameters
In-Reply-To: <1174764946.377183.140290@y80g2000hsf.googlegroups.com>
References: <1174764946.377183.140290@y80g2000hsf.googlegroups.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox