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

Re: Does PG's JDBC support prepared statements at all?

From: "Dave Cramer" <Dave(at)micro-automation(dot)net>
To: "'Dr(dot) Evil'" <drevil(at)sidereal(dot)kz>, <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Does PG's JDBC support prepared statements at all?
Date: 2001-10-21 15:21:39
Message-ID: 00f601c15a44$14c056f0$8201a8c0@inspiron (view raw or flat)
Thread:
Lists: pgsql-jdbcpgsql-patches
Remove the single quotes from '?' there is no need for them.

Dave

-----Original Message-----
From: pgsql-jdbc-owner(at)postgresql(dot)org
[mailto:pgsql-jdbc-owner(at)postgresql(dot)org] On Behalf Of Dr. Evil
Sent: October 20, 2001 7:14 PM
To: pgsql-jdbc(at)postgresql(dot)org
Subject: [JDBC] Does PG's JDBC support prepared statements at all?



There is a bunch of documentation for prepared statements in PG's JDBC,
it seems that the only thing prepared statements do is throw exceptions.

Here's some code I'm trying:

                String newvalue = "This is a new value";
                int accountnumber = 54;
                String qstring = "UPDATE foo SET message = '?' WHERE
number = ?";
		PreparedStatement st = db.prepareStatement(qstring);
                st.setString(1, newvalue);
                st.setInt(2, accountnumber);
                st.execute();
                st.clearParameters();
                st.close();

and I always get a Parameter index out of range error, which seems
impossible.  Any idea what's going on?

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster



In response to

pgsql-patches by date

Next:From: Sergey ChumakovDate: 2001-10-22 15:18:15
Subject: libpq(win32) s/errno/WSAGetLastError()/
Previous:From: Thomas O'DowdDate: 2001-10-21 12:55:44
Subject: Re: Does PG's JDBC support prepared statements at all?

pgsql-jdbc by date

Next:From: Marko KreenDate: 2001-10-21 18:08:38
Subject: Re: Whatever ... JDBC build patch
Previous:From: Thomas O'DowdDate: 2001-10-21 12:55:44
Subject: Re: Does PG's JDBC support prepared statements at all?

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