Solved

Problem in executing Stored Procedure in Java

Posted on 2012-03-20
5
609 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 500 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

Industry Leaders: 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

Suggested Solutions

Title # Comments Views Activity
numbers ascending pyramid 101 236
Oracle SQL syntax check  without executing 6 100
Error in @AspectJ Based AOP with Spring 2 23
junit example issue 2 22
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
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 about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

685 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