Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 3D9719FB311 for ; Sat, 24 Mar 2007 16:35:53 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 54467-10 for ; Sat, 24 Mar 2007 16:35:50 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id 4AE599FB298 for ; Sat, 24 Mar 2007 16:35:50 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 4212F308F7; Sat, 24 Mar 2007 20:35:49 +0100 (MET) From: "RichT" X-Newsgroups: pgsql.interfaces.jdbc Subject: Problem with string parameters Date: 24 Mar 2007 12:35:46 -0700 Organization: http://groups.google.com Lines: 27 Message-ID: <1174764946.377183.140290@y80g2000hsf.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Complaints-To: groups-abuse@google.com User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.11) Gecko/20070312 Firefox/1.5.0.11,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: y80g2000hsf.googlegroups.com; posting-host=66.92.12.90; posting-account=VhozcQ0AAADHv52p-fDo64ZLzBz7jncm To: pgsql-jdbc@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=BAYES_50 X-Spam-Level: X-Archive-Number: 200703/117 X-Sequence-Number: 16831 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?