pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Prepared Statement problem
3+ messages / 3 participants
[nested] [flat]

* Prepared Statement problem
@ 2002-10-29 15:19  ygloriau@siliage.fr
  0 siblings, 0 replies; 3+ messages in thread

From: ygloriau@siliage.fr @ 2002-10-29 15:19 UTC (permalink / raw)
  To: pgsql-jdbc

Hi all,
I'm dealing with the hugest query i've ever seen : 93 parameters !

The problem is that i got an exception when i try to add the 51th parameter.
No way to have mor ethan 50 parameters. 
Is there a solution to fix up this problem ? 
(I won't rewrite the query !)

thanks 

Yann




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Prepared statement problem
@ 2007-04-25 11:30  Djordje Nikolic <djordje@abanka.co.yu>
  0 siblings, 1 reply; 3+ messages in thread

From: Djordje Nikolic @ 2007-04-25 11:30 UTC (permalink / raw)
  To: pgsql-jdbc

I had a problem with PreparedStatement which uses ? after FROM clause.
Server reported org.postgresql.util.PSQLException: ERROR: syntax error 
at or near "$1"

This is simplified example.

PreparedStatement pstmt;
try {
  pstmt = conn.prepareStatement("SELECT * FROM ?");
  pstmt.setString(1, "ps_nalog");
  pstmt.executeQuery();
} catch (SQLException ex) {
  ex.printStackTrace();
}

Can anybody tell me where is posibble to put ? in a SELECT statement !

best regards,
Djordje Nikolic

www.abanka.co.yu






^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Prepared statement problem
@ 2007-04-25 12:29  Dave Cramer <pg@fastcrypt.com>
  parent: Djordje Nikolic <djordje@abanka.co.yu>
  0 siblings, 0 replies; 3+ messages in thread

From: Dave Cramer @ 2007-04-25 12:29 UTC (permalink / raw)
  To: Djordje Nikolic <djordje@abanka.co.yu>; +Cc: pgsql-jdbc

jdbc is using server side prepared statements.

As such the server won't allow this particular construct.

You can put the ? in for where something = ?
Dave
On 25-Apr-07, at 7:30 AM, Djordje Nikolic wrote:

> I had a problem with PreparedStatement which uses ? after FROM clause.
> Server reported org.postgresql.util.PSQLException: ERROR: syntax  
> error at or near "$1"
>
> This is simplified example.
>
> PreparedStatement pstmt;
> try {
>  pstmt = conn.prepareStatement("SELECT * FROM ?");
>  pstmt.setString(1, "ps_nalog");
>  pstmt.executeQuery();
> } catch (SQLException ex) {
>  ex.printStackTrace();
> }
>
> Can anybody tell me where is posibble to put ? in a SELECT statement !
>
> best regards,
> Djordje Nikolic
>
> www.abanka.co.yu
>
>
>
>
> ---------------------------(end of  
> broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2007-04-25 12:29 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-10-29 15:19 Prepared Statement problem ygloriau@siliage.fr
2007-04-25 11:30 Prepared statement problem Djordje Nikolic <djordje@abanka.co.yu>
2007-04-25 12:29 ` Re: Prepared statement problem Dave Cramer <pg@fastcrypt.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox