pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ragnar Hafstaư <gnari@simnet.is>
To: Brian Gunning <brian.gunning@3touch.com>
Cc: Shelby Cain <alyandon@yahoo.com>
Cc: pgsql-novice@postgresql.org
Cc: pgsql-general@postgresql.org
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] MS Access to PostgreSQL
Date: Sat, 12 Mar 2005 09:35:46 +0000
Message-ID: <1110620146.28803.9.camel@localhost.localdomain> (raw)
In-Reply-To: <!~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAArT90Qljg9UiAIBoNHno+SsKAAAAQAAAA6XQNoYyDik2zpG13jnCSAwEAAAAA@3touch.com>
References: <!~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAArT90Qljg9UiAIBoNHno+SsKAAAAQAAAA6XQNoYyDik2zpG13jnCSAwEAAAAA@3touch.com>

On Fri, 2005-03-11 at 17:52 +0000, Brian Gunning wrote:

[rearranged quoting]

> From: pgsql-jdbc-owner@postgresql.org
> --- William Shatner <shatner.william@gmail.com> wrote:
> > I have recently migrated from MS Access to
> > PostgreSQL.Previously I had
> > a SQL command
> > 
> >       ResultSet aGroupResultSet =
> > aGroupPathStmt.executeQuery(
> >           "SELECT \"groupID\",\"fullpath\" FROM
> > \"groups\" WHERE
> > \"fullpath\" Like '" +
> >           aPath + "'");
> > 
> > 
> > where aPath was equal to  'folder\another folder\%'.
> > 

> I don't think the problem isn't with the backslashes. They are escaped and
> seem to be working fine e.g. to insert a backslash in Access I had to use
> one escape character ('\\') whereas in PostgreSQL four backslashes ('\\\\')
> are required. The line that inserts the % is as follows...
> 
>       String aPath = group.getPath() + aOldGroupName + "\\%";

are the backslashes in group.getPath() + aOldGroupName escaped ?
does aGroupPathStmt.executeQuery() escape backslashes ?

did you print the SQL statement to screen or logfile to make sure
what is actually sent to  executeQuery() ?

does your language support placeholders ? this kind of problems are
usually easier to deal with with them.

gnari





view thread (7+ messages)  latest in thread

Message-ID: <1110620146.28803.9.camel@localhost.localdomain>
Permalink:  ../1110620146.28803.9.camel@localhost.localdomain/
Also on:    postgresql.org/message-id/1110620146.28803.9.camel@localhost.localdomain

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: gnari@simnet.is, brian.gunning@3touch.com, alyandon@yahoo.com, pgsql-novice@postgresql.org, pgsql-general@postgresql.org
  Subject: Re: [JDBC] MS Access to PostgreSQL
  In-Reply-To: <1110620146.28803.9.camel@localhost.localdomain>
  References: <!~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAArT90Qljg9UiAIBoNHno+SsKAAAAQAAAA6XQNoYyDik2zpG13jnCSAwEAAAAA@3touch.com> <1110620146.28803.9.camel@localhost.localdomain>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox