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

Does PG's JDBC support prepared statements at all?

From: "Dr(dot) Evil" <drevil(at)sidereal(dot)kz>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Does PG's JDBC support prepared statements at all?
Date: 2001-10-20 23:14:22
Message-ID: 20011020231422.7227.qmail@sidereal.kz (view raw or flat)
Thread:
Lists: pgsql-jdbcpgsql-patches
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?

Responses

pgsql-patches by date

Next:From: Thomas O'DowdDate: 2001-10-21 02:37:29
Subject: Re: Does PG's JDBC support prepared statements at all?
Previous:From: Dave CramerDate: 2001-10-20 22:24:39
Subject: Re: [PATCHES] Ant configuration

pgsql-jdbc by date

Next:From: Thomas O'DowdDate: 2001-10-21 02:37:29
Subject: Re: Does PG's JDBC support prepared statements at all?
Previous:From: Dr. EvilDate: 2001-10-20 22:34:05
Subject: PreparedStatement parameters question

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