Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 1532B9FBA1A for ; Mon, 9 Jul 2007 09:05:24 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 48978-04 for ; Mon, 9 Jul 2007 09:05:10 -0300 (ADT) X-Greylist: delayed 00:06:39.447261 by SQLgrey-1.7.4 Received: from web39103.mail.mud.yahoo.com (web39103.mail.mud.yahoo.com [209.191.86.254]) by postgresql.org (Postfix) with SMTP id 753659FB9F6 for ; Mon, 9 Jul 2007 09:05:08 -0300 (ADT) Received: (qmail 88959 invoked by uid 60001); 9 Jul 2007 11:58:27 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=GlcHdf1LHBW+22oGoXCUE9my3RKUs9YU8Crgp9wI7+YlPCuWfvnHdl30+c4nImmMrg7hOPVOoB5M4pm1j2JHaodQwzuRngDmBaJMkxKMdjEOrRhOhZDJz8ebLl+rolKMZ1LtXx/gekcSprMT31iT67kaSf2RZT/pejiCnFe6uIg=; X-YMail-OSG: X0VfrVAVM1l0oA730QcnrSyBU_bMMxytcu9k294zJUF4kSnhGCo_hQXftlhaeO7dLc1Ly9cUhDC3jYRsPQcW1ttgZL1pzC9m2_Kzl5js4No1ayVjGuP.GZjGGr2KSg-- Received: from [203.215.160.146] by web39103.mail.mud.yahoo.com via HTTP; Mon, 09 Jul 2007 04:58:27 PDT Date: Mon, 9 Jul 2007 04:58:27 -0700 (PDT) From: Altaf Malik Subject: Unable to prepare a statement when the object names contain more than one $ symbol To: pgsql-jdbc@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-587336999-1183982307=:87872" Content-Transfer-Encoding: 8bit Message-ID: <540504.87872.qm@web39103.mail.mud.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.974 tagged_above=0 required=5 tests=AWL=0.217, BAYES_00=-2.599, DNS_FROM_RFC_ABUSE=0.2, DNS_FROM_RFC_POST=1.708, DNS_FROM_RFC_WHOIS=1.447, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200707/33 X-Sequence-Number: 17207 --0-587336999-1183982307=:87872 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hi All, I have a table with two columns of type varchar and the table name contains two dollars. I am unable to prepare a statement for this table. Here is the code: con.createStatement().executeUpdate("create table a$b$c(a varchar, b varchar)"); PreparedStatement pstmt = con.prepareStatement("insert into a$b$c values( ? , ?)"); pstmt.setString(1,"Hello"); pstmt.setString(2,"Welcome"); pstmt.execute(); This code throws the following exception. Exception in thread "main" org.postgresql.util.PSQLException: The column index is out of range: 1, number of columns: 0. at org.postgresql.core.v3.SimpleParameterList.bind(SimpleParameterList.java:52) at org.postgresql.core.v3.SimpleParameterList.setStringParameter(SimpleParameterList.java:117) at org.postgresql.jdbc2.AbstractJdbc2Statement.bindString(AbstractJdbc2Statement.java:2118) at org.postgresql.jdbc2.AbstractJdbc2Statement.setString(AbstractJdbc2Statement.java:1241) at org.postgresql.jdbc2.AbstractJdbc2Statement.setString(AbstractJdbc2Statement.java:1227) at Main.main(Main.java:33) How can i insert values in this table using PreparedStatement? --Altaf Malik --------------------------------- Shape Yahoo! in your own image. Join our Network Research Panel today! --0-587336999-1183982307=:87872 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hi All,
 I have a table with two columns of type varchar and the table name contains two dollars. I am unable to prepare a statement for this table. Here is the code:

con.createStatement().executeUpdate("create table a$b$c(a varchar, b varchar)");
PreparedStatement pstmt = con.prepareStatement("insert into a$b$c values( ? , ?)");
pstmt.setString(1,"Hello");
pstmt.setString(2,"Welcome");
pstmt.execute();

This code throws the following exception.
Exception in thread "main" org.postgresql.util.PSQLException: The column index is out of range: 1, number of columns: 0.
        at org.postgresql.core.v3.SimpleParameterList.bind(SimpleParameterList.java:52)
        at org.postgresql.core.v3.SimpleParameterList.setStringParameter(SimpleParameterList.java:117)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.bindString(AbstractJdbc2Statement.java:2118)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.setString(AbstractJdbc2Statement.java:1241)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.setString(AbstractJdbc2Statement.java:1227)
        at Main.main(Main.java:33)

How can i insert values in this table using PreparedStatement?

--Altaf Malik


Shape Yahoo! in your own image. Join our Network Research Panel today! --0-587336999-1183982307=:87872--