Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

quoted identifier?

146 views
Skip to first unread message

asd

unread,
Nov 26, 2002, 5:37:17 PM11/26/02
to
Hi.

We have been getting the following JDBC error message intermittently when
we execute certain stored procedures:

com.sybase.jdbc2.jdbc.SybSQLException: The identifier that starts with '"'
is too long. Maximum length is 28.

Oddly enough, after we get this error from JDBC, if we then execute the
stored procedure manually using the Rapid SQL GUI, the sproc runs fine in
Rapid SQL & then runs fine using JDBC, too! But, some time later, we get
the error again.

Also, other sprocs run fine; it's always the same few that cause problems.
We can't say for sure what's distinctive about the problem sprocs, but at
least some of them do have double quotes surrounding string literals.

Our research suggests that this error is related to the QUOTED_IDENTIFIER
setting. However, (1) we never set QUOTED_IDENTIFIER anywhere & (2) it
happens intermittently.

Finally, we have been developing on Solaris with ASE 11.9, jConnect-5.2 and
jdk1.3/1.4 for years & never saw this problem. We started getting the error
using ASE 12.0 & ASE 12.5 with jConnect-5.2. We upgraded to jConnect-5.5,
but same error.

Possible solutions:
* Sybase recommends using single quotes to surround string literals in
sprocs. We believe that would probably work, but we would have to recompile
tons of code in lots of different databases.
* Also, we could execute SET QUOTED_IDENTIFIER OFF for each connection.
Again, that's a lot of code changes.
* What we really want to do is set QUOTED_IDENTIFIER off in our JDBC URL,
kinda like this:

jdbc:sybase:Tds:londb-p3.systems.london.cantor.com:9000?IGNORE_DONE_IN_PROC=true&QUOTED_IDENTIFIER=off

However, we don't know what the right syntax, if any, is.

odbcpse

unread,
Dec 2, 2002, 3:30:48 PM12/2/02
to a...@earth.com
I do not think there is anything you can do as a connection property.,
For some reason , quoted_identifiers is turned ON when jConnect connects
to ASE. You will need to set it OFF on connections.

However, there might be something to help:

SQLINITSTRING

Use this property to define a set of commands to be passed to
the back-end database server. These must be SQL commands
that can be executed using the Statement.executeUpdate( )
method.

I think you can use this for your purpose.

You add SQLINITSTRING as a property:

Properties sybProps = new Properties();
sybProps.put("user", "sa");
sybProps.put("password", "");
// SQLINITSTRING
sybProps.put("SQLINITSTRING", "set quoted_identifier off");
System.out.println("Going to connect url: " + url);
con = DriverManager.getConnection(url, sybProps);

This way you do not need to run the set everytime you connect - provided you use a
standard setup for your connection properties.

pv

Mark Hansen

unread,
Dec 2, 2002, 4:14:02 PM12/2/02
to
odbcpse wrote:
> I do not think there is anything you can do as a connection property.,
> For some reason , quoted_identifiers is turned ON when jConnect connects
> to ASE. You will need to set it OFF on connections.

I have not found that to be the case. When I connection to a Sybase
Adaptive Server, Enterprise Edition, version 12.5 from a Java client
using the jConnect 5.5 driver, I had to set quoted identifier on before
I could use quoted identifiers. It was off by default.

0 new messages