RE: JDBC 'Unterminated quoted string'

From: Peter Mount <petermount(at)maidstone(dot)gov(dot)uk>
To: "'Christopher Farley'" <chris(at)northernbrewer(dot)com>, Grant Finnemore <gaf(at)ucs(dot)co(dot)za>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: RE: JDBC 'Unterminated quoted string'
Date: 2000-11-10 09:17:21
Message-ID: 1B3D5E532D18D311861A00600865478CF1B50C@exchange1.nt.maidstone.gov.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Yes this is the correct place to report bugs in JDBC.

Peter

--
Peter Mount
Enterprise Support Officer, Maidstone Borough Council
Email: petermount(at)maidstone(dot)gov(dot)uk
WWW: http://www.maidstone.gov.uk
All views expressed within this email are not the views of Maidstone Borough
Council

-----Original Message-----
From: Christopher Farley [mailto:chris(at)northernbrewer(dot)com]
Sent: Thursday, November 09, 2000 5:50 AM
To: Grant Finnemore
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: [INTERFACES] JDBC 'Unterminated quoted string'

Grant,
Thanks for the -d2 tip, it will make my life a lot easier for quite
some time!
Actually, I already tested the 'unescaped single quote' theory, and the
JDBC driver *does* escape them for you.
The problem in my case seems to be that the JDBC driver is throwing the
'unterminated quoted string' because I am inserting a null value into a
char(1) field. I do not have any 'not null' constraints on the field.
I can easily work around this problem now that I understand it, but I'm
pretty sure this is not correct behavior for the JDBC driver. Is this the
proper forum to report bugs, if this is indeed a bug?

----
Christopher Farley
Northern Brewer / 1150 Grand Avenue / St. Paul, MN 55105
www.northernbrewer.com

On Thu, 9 Nov 2000, Grant Finnemore wrote:

> Christopher,
>
> I would suggest that you examine the query that arrives at the backend.
> (Start the postmaster with the -d2 switch)
>
> This should at least give you the source of the unterminated string, and
> presumably, we can then trace it through the execution of the JDBC driver.
>
> Offhand, I would suggest that one of the string fields in the insert has a
'
> character inside. AFAIK the postgresql jdbc driver does not automatically
> escape this character. The correct escape would be ''.
>
> Regards,
> Grant
>
> Christopher Farley wrote:
>
> > I am migrating a Java application from a commercial RDBMS to
> > Postgresql. The transition has been near-seamless, except I am getting a
> > troublesome SQLException when executing one of my PreparedStatement
> > objects.
> >
> > The SQLException is 'Unterminated quoted string', and it occurs on a
> > simple SQL insert statement. I have other insert statements which
execute
> > flawlessly, and this particular statement worked fine on a different
> > database.
> >
> > I searched the archives and the only information I could find on this
> > error had to do with quoting question-mark (?) literals with ODBC. Since
> > the JDBC PreparedStatement uses ?, I was wondering if there was a
problem
> > parsing the PreparedStatement. The only thing that distinguishes the
> > problematic PreparedStatement is that I am inserting a large number of
> > columns (21).
> >
> > I'm using the jdbc7.0-1.1.jar, and running Posgresql 7.0.2.
> >
> > Thanks if you can help!
> > ----
> > Christopher Farley
> > Northern Brewer / 1150 Grand Avenue / St. Paul, MN 55105
> > www.northernbrewer.com
>
> --
> > Poorly planned software requires a genius to write it
> > and a hero to use it.
>
> Grant Finnemore BSc(Eng) (mailto:gaf(at)ucs(dot)co(dot)za)
> Software Engineer Universal Computer Services
> Tel (+27)(11)712-1366 PO Box 31266 Braamfontein 2017, South Africa
> Cell (+27)(82)604-5536 20th Floor, 209 Smit St., Braamfontein
> Fax (+27)(11)339-3421 Johannesburg, South Africa
>
>

Browse pgsql-interfaces by date

  From Date Subject
Next Message Peter Mount 2000-11-10 09:19:29 RE: JDBC 'Unterminated quoted string'
Previous Message Phil Davey 2000-11-10 09:13:03 RE: Access 2000 and empty fields