Solved

Problem in executing Stored Procedure in Java

Posted on 2012-03-20
5
617 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
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…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

688 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