Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Problem in executing Stored Procedure in Java

Posted on 2012-03-20
5
Medium Priority
?
657 Views
Last Modified: 2012-03-25
Hi Experts...

I use sybase database and am trying to update some values into the database.

While trying to run this it throws an exception as :
com.sybase.jdbc2.jdbc.SybSQLException: The identifier that starts with 'WeeklyStudentEventClassArchiv' is too long. Maximum length is 30.

This table is in another database and thus i have to use the database name along with the table name as dhown below:
StudActive..WeeklyStudentEventClassArchiv which apparently exceeds 30 characters.

I have to use the databasename..tablename in the stored procudure but its throwing an exception.

This happens even if i physically embed the sql in the java code.

How can this be solved.
Please help...
0
Comment
Question by:gaugeta
  • 2
  • 2
5 Comments
 
LVL 47

Expert Comment

by:for_yan
ID: 37742652
This error will occur if the actual root name of the table is longer than 30 characters. Count. The characters in youir actual name - )ou can add schema and link and anithing elase - that should nnot go into the count - it. Is your name only without any prefixes which is too long. At least that is how it ois with Orace. I suspect tghe same rule about the names of database objects  exists in Sybase.
0
 
LVL 13

Expert Comment

by:alpmoon
ID: 37743129
As much as I see you are using jdbc2. You may need to use jdbc3 to access tables with long names.
0
 
LVL 13

Expert Comment

by:alpmoon
ID: 37743268
Actually, if you are using any version of Jconnect earlier than 6.05, it might be the problem:

"JCONNECT_VERSION   Features

“6.05”
      
jConnect 6.05 behaves in the same way as jConnect 6.0, except that in this version:

    *      jConnect supports computed columns, including their metadata information.
    *      jConnect supports large identifiers. With large identifiers, you can use identifiers or object names with lengths of up to 255 bytes. The large identifier applies to most user-defined identifiers, including table name, column name, and index name."
0
 

Author Comment

by:gaugeta
ID: 37746601
@for_yan:Thanks for the reply.
Yes i have a prefix to the table name as i have told.
I have dbname..table name.But here indicates that only the table name has more than 30 characters which it does having 31 characters.
What did you mean by add schema and link anything and it should not go into account.

@ alpmoon:Thanks for the reply.I cannot change the type of the connection as the whole application in production uses the curemt version and cannot be changed at an instant.
0
 
LVL 47

Accepted Solution

by:
for_yan earned 2000 total points
ID: 37750352
>only the table name has more than 30 characters which it does having 31 characters.

>What did you mean by add schema and link anything and it should not go into account.

That is exactly what I meant - it does not matter how long will be the whole thing together with the schema, potentially db_link, etc. - the whole thing may really be long.
It is just the actual name of the table itself (or the view itself, or say the sequence itself)
which cannot be longer than 30 chars - and this is what this error is about.
And I don't know about Sybase, but in Oracle this is not the limitation of JDBC driver - this is the limitation of the Oracle itself - you cannot create the table  with name longer than 30 chars directly from SQL prompt; Oracle requires table names (and other database objects names) to be <= 30 chars.
Maybe in Sybase there is no such limitation and then maybe JDBC driver imposes this limitation, that would explain the existence of such table, which was probably created  without JDBC; that can happen. In this case version of the driver may matter.
in general, if only possible I'd rather rename the table and make appropriate changes everywhere and in general avoid creating tables with names >30 chars
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question