ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » ExceptionList in JCN - WBIMB 6.0

Post new topic  Reply to topic
 ExceptionList in JCN - WBIMB 6.0 « View previous topic :: View next topic » 
Author Message
nab054371
PostPosted: Fri Oct 05, 2007 7:36 am    Post subject: ExceptionList in JCN - WBIMB 6.0 Reply with quote

Disciple

Joined: 15 Nov 2006
Posts: 173

Here's what my code snippet looks like:


try{

sqlExecState = createSQLStatement("TESTDB",SQLstatement);
sqlExecstate.setThrowExceptionOnDatabaseError(true);

}
catch{MbException e){

//Exception handling logic

}


It looks like if I were to run into MbDatabaseException(DB2 native error),the java stack from exception list does not include native DB SQL error.


However if I change the sqlExecstate.setThrowExceptionOnDatabaseError(true) to
sqlExecstate.setThrowExceptionOnDatabaseError(false) and then check for sql errors(see below), it looks like I am able to capture native DB SQL error text!

try{
sqlExecState = createSQLStatement("TESTDB",SQLstatement);
sqlExecstate.setThrowExceptionOnDatabaseError(false);
int sqlState = sqlExecState.getSQLCode();
String sqlError = sqlExecState.getSQLErrorText();

}
catch{MbException e){

//Exception handling logic

}

I was wondering if there would be a way to capture such native DB SQL errors even with
sqlExecstate.setThrowExceptionOnDatabaseError(true) option?
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Oct 05, 2007 1:47 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

ThrowExceptionsOnDatabaseError(true) will create ESQL Exceptions.

I won't go so far as to say that it's impossible to catch ESQL exceptions from a JavaCompute node.

I will merely limit myself to calling it "likely very difficult".
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
nab054371
PostPosted: Fri Oct 05, 2007 2:08 pm    Post subject: Reply with quote

Disciple

Joined: 15 Nov 2006
Posts: 173

Hi Jeff,

I am reffering to Native DB2 SQL exceptions not ESQL exceptions!

thanks
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Oct 05, 2007 2:52 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

nab054371 wrote:
Hi Jeff,

I am reffering to Native DB2 SQL exceptions not ESQL exceptions!

thanks


Well depending on what you set up the SQL exception will stop the ESQL from executing and raise an ESQL exception...

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
nab054371
PostPosted: Fri Oct 05, 2007 2:57 pm    Post subject: Reply with quote

Disciple

Joined: 15 Nov 2006
Posts: 173

ok,help me understand this-

I am using a JCN and making a select call to DB.Why would it generate ESQL exception?

Maybe I am seeing this wrong,but looks like it generates a bunch of exceptions the last one being CHILD SQL EXCEPTION.But nothing that refers to specific SQL error code in DB2..
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Oct 05, 2007 4:29 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

It is my guess/belief, without having seen the source code, that MbSQLStatement is actually handled by the ESQL/C++ Runtime.

So any exceptions it catches and regenerates... will be thrown by the ESQL/C++ Runtime... which will be "likely very difficult" to catch from the Java runtime.

Unless you tell it not to specifically catch/regenerate exceptions.. in which case as you have shown they will be thrown to the JNI/MbJava interface and thus passed into the Java Runtime.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sat Oct 06, 2007 3:49 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

As you are using a JCN have you tried
Code:
catch (SQLException sqle) {
  some code }
catch (MbException mbe) {
  some code}
catch (Exception ge) {
  some code}
?

and which one did get triggered?

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
nab054371
PostPosted: Thu Oct 11, 2007 7:17 am    Post subject: Reply with quote

Disciple

Joined: 15 Nov 2006
Posts: 173

I am not sure what u mean by SQLException?There is no just thing as SQL exception thrown by MB JCN.It throws MQDatabaseException, a subclass of MQException..
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » ExceptionList in JCN - WBIMB 6.0
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.