Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Problem in executing Stored Procedure in Java

Posted on 2012-03-20
5
Medium Priority
?
639 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 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

636 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