Re: [SQL] [JDBC] Prepare Statement

2004-06-21 Thread Jie Liang
Does plperl catch the plan also? Thanks. Jie Liang -Original Message- From: Kris Jurka [mailto:[EMAIL PROTECTED] Sent: Friday, June 18, 2004 2:47 PM To: Jie Liang Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [JDBC] Prepare Statement On Fri, 18 Jun 2004, Jie Liang wrote: >

Re: [SQL] [JDBC] Prepare Statement

2004-06-20 Thread Kris Jurka
On Fri, 18 Jun 2004, Jie Liang wrote: > So, I think that PreparedStatement should have a way at least case a > String to an Array or a way to create a Array, because of > conn.prepareStatement("SELECT myfunction('{1,2,3}')") is NOT very > useful. Right, this is a known issue. It's on the list.

Re: [SQL] [JDBC] Prepare Statement

2004-06-20 Thread Kris Jurka
On Fri, 18 Jun 2004, Jie Liang wrote: > However, I am still thinking if I call one SELECT and one DELECT and one > UPDATE and one INSERT a thousand times against same table with different > arguments, should I consider performance iusse? Right, this is a case where some benefits can be found, b

Re: [SQL] [JDBC] Prepare Statement

2004-06-20 Thread Kris Jurka
On Thu, 17 Jun 2004, Jie Liang wrote: > 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. > I suppose, but I'm going to put it pretty close to the bottom of my todo list because it still works even though it doesn't use

Re: [SQL] [JDBC] Prepare Statement

2004-06-20 Thread Kris Jurka
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:

Re: [SQL] [JDBC] Prepare Statement

2004-06-20 Thread Kris Jurka
On Thu, 17 Jun 2004, Jie Liang wrote: > Kris, > I have another question, I saw some discussion regarding > PreparedStatement work with array argument, I get a error when I try to > play with it. > E.g. > I have myfunction(int[]), > So, > PrepareStatement st = conn.prepareStatment("SELECT myfunc

Re: [SQL] [JDBC] Prepare Statement

2004-06-20 Thread Kris Jurka
On Thu, 17 Jun 2004, Jie Liang wrote: > Kirs, > > I re-compile with setUseServerPrepare(true), it works fine, thanks. > However, reading from my log file, what I saw is that five same SELECTs > with different argument, so I am wondering that the PrepareStatement > really save time than individu

Re: [SQL] [JDBC] Prepare Statement

2004-06-20 Thread Kris Jurka
On Wed, 16 Jun 2004, Jie Liang wrote: > Kris, > Thank you for your valuable response, I used the code you list > following: > > [7.5 code example] > > Then, the compiler complaint: > ServerSidePreparedStatement.java:20: cannot resolve symbol symbol : > method setPrepareThreshold (int) > locati

Re: [SQL] [JDBC] Prepare Statement

2004-06-20 Thread Kris Jurka
On Mon, 14 Jun 2004, Jie Liang wrote: > I have a question about performance, in SQL commands: there is a > prepare/execute command, document says it will improve the performance > while repeatly execute a statement. In java.sql: there is a > PreparedStatement object, which can store precompiled

Re: [SQL] [JDBC] Prepare Statement

2004-06-18 Thread Jie Liang
So, I think that PreparedStatement should have a way at least case a String to an Array or a way to create a Array, because of conn.prepareStatement("SELECT myfunction('{1,2,3}')") is NOT very useful. Comment? Jie Liang -Original Message- From: Kris Jurka [mailto:[EMAIL PROTECTED] Sen

Re: [SQL] [JDBC] Prepare Statement

2004-06-18 Thread Jie Liang
Nope, I think you are right. The improvement of performance will be minimal. Because that to parse "SELECT * FROM myfunction(?,?,?)" is very very quick. However, I am still thinking if I call one SELECT and one DELECT and one UPDATE and one INSERT a thousand times against same table with different

Re: [SQL] [JDBC] Prepare Statement

2004-06-17 Thread Jie Liang
Kris, I have another question, I saw some discussion regarding PreparedStatement work with array argument, I get a error when I try to play with it. E.g. I have myfunction(int[]), So, PrepareStatement st = conn.prepareStatment("SELECT myfunction(?)"); String arr="{1,2,3}"; St.setString(1,arr}; Res

Re: [SQL] [JDBC] Prepare Statement

2004-06-17 Thread Jie Liang
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:[EMAIL PROTECTED] Sent: Thursday, June 17, 2004 3:26 PM To: Jie Liang Cc: Tom Lane; [EMAIL PROTECTED]; [

Re: [SQL] [JDBC] Prepare Statement

2004-06-17 Thread Jie Liang
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

Re: [SQL] [JDBC] Prepare Statement

2004-06-17 Thread Jie Liang
Kirs, I re-compile with setUseServerPrepare(true), it works fine, thanks. However, reading from my log file, what I saw is that five same SELECTs with different argument, so I am wondering that the PrepareStatement really save time than individualy execute five SELECTs ??? If I use one "parepare

Re: [SQL] [JDBC] Prepare Statement

2004-06-16 Thread Jie Liang
Kris, Thank you for your valuable response, I used the code you list following: import java.sql.*; public class ServerSidePreparedStatement { public static void main(String args[]) throws Exception { Class.forName("org.postgresql.Driver"); String ur