Solved

Problem in executing Stored Procedure in Java

Posted on 2012-03-20
5
588 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
@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 500 total points
Comment Utility
>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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now