Solved

How do I get Sybase ASE to throw an error that Java can catch?

Posted on 2014-11-14
4
483 Views
1 Endorsement
Last Modified: 2014-11-18
Good Morning All,

I am in need of some expert advice.  My environment is set up as follows:  
Database:  Sybase ASE 15.7, Open Client 15
Language:  Java 1.7.0_45

I have a stored procedure that is raising an error but java is not catching it.  Is there any way that I can force it.  I see ways to do this in other databases but nothing for Sybase.

I am performing a batch update using prepared statements and the update being called to perform the update is where the raiserror is thrown.
1
Comment
Question by:Monica Stanley
  • 2
  • 2
4 Comments
 
LVL 11

Accepted Solution

by:
John_Vidmar earned 500 total points
Comment Utility
Sybase ASE has a function called RAISERROR
1
 

Author Comment

by:Monica Stanley
Comment Utility
I am aware of the RAISERROR function.  I use it extensively.  My problem is this it is not being caught in the SQLException block.
1
 
LVL 11

Expert Comment

by:John_Vidmar
Comment Utility
In your Java try-catch, add a more generic exception-type first, and trace through your code to see what (if anything) is being caught.
0
 

Author Closing Comment

by:Monica Stanley
Comment Utility
Thank you for taking the time to answer John.  I just realized that I was not on the correct database sever and was calling a version of my stored procedure that does not have the raise error in it.  It is working correctly now.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

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