From: | "Jie Liang" <jie(at)stbernard(dot)com> |
---|---|
To: | "Kris Jurka" <books(at)ejurka(dot)com> |
Cc: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, <pgsql-sql(at)postgresql(dot)org>, <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: Prepare Statement |
Date: | 2004-06-17 22:50:33 |
Message-ID: | E7E213858379814A9AE48CA6754F5ECB03451936@mail01.stbernard.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc pgsql-sql |
Hmm, intersting.
I am using jdk 1.3.1, and pg74.213.jdbc2.jar driver, I hope this bug
could be fixed in later version.
Thanks.
Jie Liang
-----Original Message-----
From: Kris Jurka [mailto:books(at)ejurka(dot)com]
Sent: Thursday, June 17, 2004 3:26 PM
To: Jie Liang
Cc: Tom Lane; pgsql-sql(at)postgresql(dot)org; pgsql-jdbc(at)postgresql(dot)org
Subject: Re: [JDBC] Prepare Statement
On Thu, 17 Jun 2004, Jie Liang wrote:
> Kris,
> You are right, I modified that piece of code a little bit,
> CallableStatement stmt = conn.prepareCall("{?=call chr(?)}"); Then my
> log file were: Select * from chr(65) as result;
> Select * from chr(66) as result;
> ......
> However, if I use:
> PrepareStatement stmt = conn.prepareStatement("SELECT chr(?)");
> Then my log file are same as yours.i.e. it use PREPARE and EXECUTE.
>
> So, I am getting confusion.
> I think CallableStatement is extended from PrepareStatement, it should
> have same behaviou.
>
What's happening here is that you can only use prepared statements for
certain operations. You can't for example prepare a CREATE TABLE
statement. The driver examines the query to see if it is valid for
preparing and I believe the problem here is that with a callable
statement
it is examinging the query with "call" before it is transformed to a
SELECT, so it doesn't recognize it as a preparable. This looks like a
bug
to me.
Kris Jurka
From | Date | Subject | |
---|---|---|---|
Next Message | Gerbrand van Dieijen | 2004-06-17 23:38:12 | Re: Portable Java Data Layer based on JDBC |
Previous Message | Liz | 2004-06-17 22:45:10 | Re: Portable Java Data Layer based on JDBC |
From | Date | Subject | |
---|---|---|---|
Next Message | Jie Liang | 2004-06-18 03:09:16 | Re: Prepare Statement |
Previous Message | Kris Jurka | 2004-06-17 22:25:54 | Re: Prepare Statement |