Subject | Re: How is statement pooling working ? (2nd try) |
---|---|
Author | rcrfb |
Post date | 2004-08-06T05:59:10Z |
--- In Firebird-Java@yahoogroups.com, Carsten Schäfer
<ca_schaefer@g...> wrote:
best clear the param list of the prepared statement before
reusing it (to know from experience --- and log debugging:-):
Connection con = getConnection(); // gets a connection from Pool.
PreparedStatement ps = con.prepareStatement(some_sql);
while(true) {
ps.clearParameters(); // Clear params from prev. run
ps.setInt(1,1);
ps.execute();
}
con close();
Roger
<ca_schaefer@g...> wrote:
> Roman Rokytskyy wrote:Even thoug it is not really needed (in this example),
> >> If not, can someone please give examples for using
> >> statement-pooling.
> >
> > Connection con = getConnection(); // gets a connection from Pool.
> > while(true) {
> > PreparedStatement ps = con.prepareStatement(some_sql);
> > ps.setInt(1,1);
> > ps.execute();
> > }
> > con close();
> >
> But i could simply use
> Connection con = getConnection(); // gets a connection from Pool.
> PreparedStatement ps = con.prepareStatement(some_sql);
> while(true) {
> ps.setInt(1,1);
> ps.execute();
> }
> con close();
>
> to achieve the same, or not ?
>
> I hope you will release 1.5 and 1.5.1 soon ;)
> Thanks for your support.
>
> Carsten.
best clear the param list of the prepared statement before
reusing it (to know from experience --- and log debugging:-):
Connection con = getConnection(); // gets a connection from Pool.
PreparedStatement ps = con.prepareStatement(some_sql);
while(true) {
ps.clearParameters(); // Clear params from prev. run
ps.setInt(1,1);
ps.execute();
}
con close();
Roger