db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <knut.hat...@oracle.com>
Subject Re: Exception while inserting a record
Date Thu, 13 Sep 2012 08:46:32 GMT
Suat Gonul <suatgonul@gmail.com> writes:

> Hi everyone,
>
> I have a table having two columns: id (Primary key, varchar 1024),
> revision(long). There is also an index on the revision field.
>
> I can insert records in which the id has more than 128 characters into
> this table using PreparedStatement when the query is as follows:
> INSERT INTO table (id,revision) VALUES(?, ?). If the query is as
> follows: INSERT INTO table (id,revision) VALUES(<value having more than
> 128 characters>, 1) or if I use the regular Statement object,
> I get an exception as follows:
>
> Caused by: java.sql.SQLSyntaxErrorException: The name
> 'aaaaabbbbbaaaaabbbbbaaaaabbbbbaaaaabbbbbaaaaabbbbbaaaaabbbbbaaaaabbbbbaaaaabbbbbaaaaabbbbbaaaaabbbbbaaaaabbbbbaaaaabbbbbaaaaabbbbb'
> is too long. The maximum length is '128'.

Hi Suat,

I think you may get this message if you're using double-quotes (")
instead of single-quotes (') around the string literal. If you use
double-quotes, the string is interpreted as an identifier instead of a
character string, and identifiers are limited to 128 characters. Could
that be what you are seeing?

-- 
Knut Anders

Mime
View raw message