Re: [JDBC] MS Access to PostgreSQL - Mailing list pgsql-general

From Ragnar Hafstað
Subject Re: [JDBC] MS Access to PostgreSQL
Date
Msg-id 1110620146.28803.9.camel@localhost.localdomain
Whole thread Raw
In response to Re: [JDBC] MS Access to PostgreSQL  ("Brian Gunning" <brian.gunning@3touch.com>)
List pgsql-general
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



pgsql-general by date:

Previous
From: Ian Barwick
Date:
Subject: Re: Hash problem
Next
From: Ragnar Hafstað
Date:
Subject: Re: Checking for schedule conflicts