aspose file tools*
The moose likes JDBC and the fly likes SQLException handling problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "SQLException handling problem" Watch "SQLException handling problem" New topic

SQLException handling problem

Jayadev Pulaparty
Ranch Hand

Joined: Mar 25, 2002
Posts: 662

I'm having a weird problem with handling of SQLException. I have a caller method inside which i'm calling a called method. The code inside the called method includes some jdbc stuff and can potentially throw an SQLException.

Please see below -
Class A{

public void callerMethod(){

new B().calledMethod();
..... // some other code here
}catch(SQLException sqle)

Class B{

public void calledMethod()throws SQLException{

// some jdbc calls here
}catch(SQLException sqle)
throw sqle;

Now, the weird part is that the classes get compiled in WSAD environment, but not in standalone WebSphere AppServer environment, with the following error during compilation -

javac - callerMethod() "java.lang.Exception" should be handled or thrown
Jayadev Pulaparty
Ranch Hand

Joined: Mar 25, 2002
Posts: 662
Any replies please.

Denis Spirin
Ranch Hand

Joined: Mar 22, 2004
Posts: 72
I have one question: How is it related to Sun Certified Java Developer Exam?

Regards<br /> <br />Ph.D.<br />SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJD 2
Jayadev Pulaparty
Ranch Hand

Joined: Mar 25, 2002
Posts: 662
I wanted to see if any of you people had already come across this problem. Thats all.
Philippe Maquet

Joined: Jun 02, 2003
Posts: 1872
I'm moving this to the JDBC forum.


Jeanne Boyarsky
internet detective

Joined: May 26, 2003
Posts: 29220

Are you using the same version of java are you using in WSAD and Websphere?

[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
I agree. Here's the link:
subject: SQLException handling problem
Similar Threads
Design implementation Doubt Please tell me the best approach
Exception handling in finally block
Is ths Transaction Handling Write or Wrong ?
Could not locate DB driver
Another code snippet about SQLException