简体   繁体   中英

Cannot Execute Stored Procedure using JDBC

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.

The Stored Procedue is as shown:
create proc dbo.sp_getStudentList(
@stDate int,
@endDate int
)
as
begin
set nocount on

      select distinct studCode
      StudActive..WeeklyStudentEventClassArchive      
      where studCode > 0
      and courseStartDate between @stDate and @endDate 



end

StudActive..WeeklyStudentEventClassArchiv which apparently exceeds 30 characters.

Yes - I count 41.

Rename the table and/or the stored proc and you should be fine. It wounds like a limitation of either the JDBC driver or the database.

Your JDBC driver is out of date. Updating to a later version might help solve your problem.

First download a more recent jConnect driver from the Sybase website. Then update your code to use the new driver package. You will also need to change your code, as the package name of the driver changes for each new version of the specification. (The current package is com.sybase.jdbcx...)

Take a look at the programmers reference for more information.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM