You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Warren Bell <wa...@clarksnutrition.com> on 2008/08/18 19:56:39 UTC
Upgrading from PostgreSQL 8.1 to 8.3 and escaping special characters
I am having a problem escaping certain characters like the apostrophe
\'.n in PostgreSQL 8.3 after upgradeing from 8.1 I am now getting the
following error:
syntax error at or near "S" at character 282
that is referring to an apostrophe in an insert statement.
I am not escaping this character in my code. I am assuming that Ibatis
or the driver is escaping it. I am using the
postgresql-8.3-603.jdbc3.jar as
the driver.
I have read that Postgres 8.3 now escapes special characters like this
E'Joe\'s', but how do I get this to work without going through all my
code and shouldn't this be done by the
driver.
Has anyone else had this problem after upgrading to Postgres 8.3? I have
tried the Postgres users list and the Postgres JDBC users list and have
gotten no where.
--
Thanks,
Warren Bell
909-645-8864
warren@clarksnutrition.com
Re: Upgrading from PostgreSQL 8.1 to 8.3 and escaping special characters
Posted by Clinton Begin <cl...@gmail.com>.
FWIW: iBATIS doesn't escape anything except for parameters through the
PreparedStatement#setXxxxxx() methods (which is the driver's
implementation).
Clinton
On Mon, Aug 18, 2008 at 11:56 AM, Warren Bell <wa...@clarksnutrition.com>wrote:
> I am having a problem escaping certain characters like the apostrophe \'.n
> in PostgreSQL 8.3 after upgradeing from 8.1 I am now getting the following
> error:
>
> syntax error at or near "S" at character 282
>
> that is referring to an apostrophe in an insert statement.
>
> I am not escaping this character in my code. I am assuming that Ibatis or
> the driver is escaping it. I am using the postgresql-8.3-603.jdbc3.jar as
> the driver.
>
> I have read that Postgres 8.3 now escapes special characters like this
> E'Joe\'s', but how do I get this to work without going through all my code
> and shouldn't this be done by the
> driver.
>
> Has anyone else had this problem after upgrading to Postgres 8.3? I have
> tried the Postgres users list and the Postgres JDBC users list and have
> gotten no where.
>
> --
> Thanks,
>
> Warren Bell
> 909-645-8864
> warren@clarksnutrition.com
>
>
Re: Upgrading from PostgreSQL 8.1 to 8.3 and escaping special characters
Posted by Warren Bell <wa...@clarksnutrition.com>.
Graeme J Sweeney wrote:
> On Mon, 18 Aug 2008, Warren Bell wrote:
>
>> Has anyone else had this problem after upgrading to Postgres 8.3? I
>> have tried the Postgres users list and the Postgres JDBC users list
>> and have gotten no where.
>
> Have you tried the 8.1 driver with 'compatible=8.1' in the connection
> string?
>
> IIRC I ran a 7.4 driver against 8.3 while testing a legacy
> (non-ibatis) webapp.
>
> There is also this setting:
>
> http://www.postgresql.org/docs/8.2/static/runtime-config-compatible.html#GUC-STANDARD-CONFORMING-STRINGS
>
>
I have tried the standard conforming string options and had troubles
with it. I have not tried the 8.1 driver with the 'compatible=8.1' in
the connection string. I will give that a try.
Thanks,
Warren
Re: Upgrading from PostgreSQL 8.1 to 8.3 and escaping special
characters
Posted by Graeme J Sweeney <ib...@gjsweeney.com>.
On Mon, 18 Aug 2008, Warren Bell wrote:
> Has anyone else had this problem after upgrading to Postgres 8.3? I have
> tried the Postgres users list and the Postgres JDBC users list and have
> gotten no where.
Have you tried the 8.1 driver with 'compatible=8.1' in the connection
string?
IIRC I ran a 7.4 driver against 8.3 while testing a legacy
(non-ibatis) webapp.
There is also this setting:
http://www.postgresql.org/docs/8.2/static/runtime-config-compatible.html#GUC-STANDARD-CONFORMING-STRINGS
--
Graeme -