Skip site navigation (1) Skip section navigation (2)

Problem with string parameters

From: "RichT" <rricht(at)pacbell(dot)net>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Problem with string parameters
Date: 2007-03-24 19:35:46
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
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 = ?

The code does
pStmt = conn.prepareStatement(query);
int paramNo = 1;
pStmt.setString(paramNo, monitorName);
pStmt.setString(paramNo, monitorName);

Where monitorName is the String "SourceHealth"

Why do I get the exception?


pgsql-jdbc by date

Next:From: Giuseppe SaccoDate: 2007-03-26 08:05:59
Subject: Re: Problem with string parameters
Previous:From: Randall SmithDate: 2007-03-23 19:46:38
Subject: Re: query manipulation

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group