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

Поиск
Список
Период
Сортировка
От Altaf Malik
Тема Unable to prepare a statement when the object names contain more than one $ symbol
Дата
Msg-id 540504.87872.qm@web39103.mail.mud.yahoo.com
обсуждение исходный текст
Ответы Re: Unable to prepare a statement when the object names contain more than one $ symbol
Список 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( ? , ?)");
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!

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Marek Lewczuk
Дата:
Сообщение: Re: patch - support for multi-dimensional arrays and NULL values
Следующее
От: student23
Дата:
Сообщение: stddev_pop, stddev_samp strange behaviour