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

Unable to prepare a statement when the object names contain more than one $ symbol

From: Altaf Malik <mmalik_altaf(at)yahoo(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Unable to prepare a statement when the object names contain more than one $ symbol
Date: 2007-07-09 11:58:27
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
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( ? , ?)");

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(
        at org.postgresql.core.v3.SimpleParameterList.setStringParameter(
        at org.postgresql.jdbc2.AbstractJdbc2Statement.bindString(
        at org.postgresql.jdbc2.AbstractJdbc2Statement.setString(
        at org.postgresql.jdbc2.AbstractJdbc2Statement.setString(
        at Main.main(

How can i insert values in this table using PreparedStatement?

--Altaf Malik

Shape Yahoo! in your own image.  Join our Network Research Panel today!


pgsql-jdbc by date

Next:From: student23Date: 2007-07-09 12:29:41
Subject: stddev_pop, stddev_samp strange behaviour
Previous:From: Marek LewczukDate: 2007-07-09 09:00:24
Subject: Re: patch - support for multi-dimensional arrays and NULL values

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