Re: [JDBC] Prepared statement performance...

From: "Peter Kovacs" <peter(dot)kovacs(at)sysdata(dot)siemens(dot)hu>
To: "Curt Sampson" <cjs(at)cynic(dot)net>, "Barry Lind" <barry(at)xythos(dot)com>
Cc: "Dmitry Tkach" <dmitry(at)openratings(dot)com>, <pgsql-general(at)postgresql(dot)org>, <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: [JDBC] Prepared statement performance...
Date: 2002-10-14 07:30:41
Message-ID: 00fe01c27353$9d67caa0$55550a8b@ACER
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-jdbc

> > The uses of the Statement object and PreparedStatement object do not
> > IMHO have anything to do with you many times you use them. They have to
> > do with how you supply values in the sql statement. If you use just the
> > Statement object you are required to know the postgres date format in
> > order to include a date value, where it is much easier (and more
> > portable across databases) to just use a PreparedStatement, a ?, and a
> > setDate() call.
>
> I agree entirely. Even more importantly, it's much, much more difficult
> to write a secure application (one not subject to SQL injection attacks)
> if you are forced to quote data yourself. The driver already knows how
> to deal with any string you pass to it; why would you want to re-write
> that code, possibily introducing errors into it? (For those not familiar
> with SQL injection attacks, I'm referring to the situation where someone
> types, say, "foo'; DROP TABLE bar;" into the "Name" field on your web
> form, or whatever.)
>

I do not clearly understand what the problem is with someone typing in
"foo'; DROP TABLE bar;" into the "Name" field on your web form.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Toby 2002-10-14 07:59:50 Re: [GENERAL] Prepared statement performance...
Previous Message Andrew Snow 2002-10-14 06:37:49 Re: incompatibility with crystal reports?

Browse pgsql-jdbc by date

  From Date Subject
Next Message Toby 2002-10-14 07:59:50 Re: [GENERAL] Prepared statement performance...
Previous Message Shridhar Daithankar 2002-10-14 06:13:46 Re: [HACKERS] MySQL vs PostgreSQL.