Skip site navigation (1) Skip section navigation (2)

Re: [JDBC] MS Access to PostgreSQL

From: Ragnar Hafstað <gnari(at)simnet(dot)is>
To: Brian Gunning <brian(dot)gunning(at)3touch(dot)com>
Cc: 'Shelby Cain' <alyandon(at)yahoo(dot)com>, pgsql-novice(at)postgresql(dot)org,pgsql-general(at)postgresql(dot)org, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: [JDBC] MS Access to PostgreSQL
Date: 2005-03-12 09:35:46
Message-ID: 1110620146.28803.9.camel@localhost.localdomain (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-jdbcpgsql-novice
On Fri, 2005-03-11 at 17:52 +0000, Brian Gunning wrote:

[rearranged quoting]

> From: pgsql-jdbc-owner(at)postgresql(dot)org
> --- William Shatner <shatner(dot)william(at)gmail(dot)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



In response to

pgsql-novice by date

Next:From: Todd LewisDate: 2005-03-12 22:50:41
Subject: Re: complex queries
Previous:From: Sandy Eggi MartediDate: 2005-03-12 06:40:31
Subject: Compiling Data Type

pgsql-jdbc by date

Next:From: Nikola MilutinovicDate: 2005-03-12 22:24:53
Subject: How to get automatically generated "id" field
Previous:From: Simon MosesDate: 2005-03-12 04:35:25
Subject: Re: preoblem in jdbc postgresql and tomcat

pgsql-general by date

Next:From: Ragnar HafstaðDate: 2005-03-12 10:13:33
Subject: Re: Checking for schedule conflicts
Previous:From: Ian BarwickDate: 2005-03-12 08:40:02
Subject: Re: Hash problem

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group