Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

wrong exception message thrown by weblogic if connection pool is used

2 views
Skip to first unread message

mayur

unread,
Jan 16, 2004, 8:46:26 AM1/16/04
to

We are using weblogic 8 SP1 application server for hosting our application. we
have configured a connection pool using sybase driver 5.5 (JConn) for connecting
to sybase 11. We are executing stored procedures using connection pools to get
a connection and execute procedures using jdbc transactions.

Most the stored procedures we execute are working fine in expected ways but few
of them have some problem. Procedures are expected to throw SQLException, whenever
some procedure raises error. this error would be some business rule being violated
or wrong data entry.These procedures are updating or deleteing some table rows,
which invoke respective database triggers and these triggers are checking for
some business rules. Now whenever these triggers raise an error, it comes to java
code as an SQLException with the actual error message.

Our problem is that, we are not getting proper SQLException (In some of the stored
procedures), when we are executing them using connection picked up from weblogic
connection pool.Instead its throwing some other exception which is different.
I am printing trace for further clarity.

Code snippet is like this:

try{

connection.setAutoCommit(false);
executeProcedure();
connection.commit();
}catch(Exception ex)
{
ex.printStackTrace();
connection.rollback();
}

[java] com.sybase.jdbc2.jdbc.SybSQLWarning: Transaction count after
EXECUTE indicates that
a COMMIT or ROLLBACK TRAN is missing. Previous count = 0, Current count = 1.
[java] 2003-12-11 05:26:53,140 ERROR - Transaction count after EXECUTE indicates
that a COMMIT o
r ROLLBACK TRAN is missing. Previous count = 0, Current count = 1.
[java]
[java]
[java] at weblogic.rjvm.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:108)
[java] com.sybase.jdbc2.jdbc.SybSQLWarning: Transaction count after EXECUTE
indicates that a CO
MMIT or ROLLBACK TRAN is missing. Previous count = 0, Current count = 1.
[java]
[java] at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:138)
[java] at weblogic.rjvm.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:108)
[java] at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:138)
[java] at weblogic.jdbc.rmi.internal.CallableStatementImpl_weblogic_jdbc_wrapper_Ca
llableStatement_com_sybase_jdbc2_jdbc_SybCallableStatement_811_WLStub.executeUpdate(Unknown
Source)
[java] at weblogic.jdbc.rmi.internal.CallableStatementImpl_weblogic_jdbc_wrapper_CallableStatement_
com_sybase_jdbc2_jdbc_SybCallableStatement_811_WLStub.executeUpdate(Unknown Source)
[java] at weblogic.jdbc.rmi.internal.CallableStatementStub_weblogic_jdbc_rmi_internal_Calla
bleStatementImpl_weblogic_jdbc_wrapper_CallableStatement_com_sybase_jdbc2_jdbc_SybCallableStatement_
811_WLStub.executeUpdate(Unknown Source)
[java] at weblogic.jdbc.rmi.internal.CallableStatementStub_weblogic_jdbc_rmi_internal_Calla
bleStatementImpl_weblogic_jdbc_wrapper_CallableStatement_com_sybase_jdbc2_jdbc_SybCallableStatement_
811_WLStub.executeUpdate(Unknown Source)
[java] at weblogic.jdbc.rmi.SerialCallableStatement_weblogic_jdbc_rmi_internal_CallableStat
ementStub_weblogic_jdbc_rmi_internal_CallableStatementImpl_weblogic_jdbc_wrapper_CallableStatement_c
om_sybase_jdbc2_jdbc_SybCallableStatement_811_WLStub.executeUpdate(Unknown Source)
[java] at weblogic.jdbc.rmi.SerialCallableStatement_weblogic_jdbc_rmi_internal_CallableStat
ementStub_weblogic_jdbc_rmi_internal_CallableStatementImpl_weblogic_jdbc_wrapper_CallableStatement_c
om_sybase_jdbc2_jdbc_SybCallableStatement_811_WLStub.executeUpdate(Unknown Source)
[java] at com.un.imis.common.TransactionManager.utTransactionManager.executeProcedure(utTra
nsactionManager.java:351)
[java] at com.un.imis.common.TransactionManager.utTransactionManager.executeProcedure(utTra
nsactionManager.java:351)




If we make direct database connection using same driver and same code, we get
the proper exception. I am printing it below:

[java] 2003-12-11 08:42:02,156 ERROR - tgcitynodeldsal
[java] com.sybase.jdbc2.jdbc.SybSQLException: tgcitynodeldsal
[java] com.sybase.jdbc2.jdbc.SybSQLException: tgcitynodeldsal
[java] [java] at com.sybase.jdbc2.tds.Tds.processEed(Tds.java:2542)
[java] at com.sybase.jdbc2.tds.Tds.nextResult(Tds.java:1947)
at com.sybase.jdbc2.tds.Tds.processEed(Tds.java:2542)
[java] at com.sybase.jdbc2.tds.Tds.nextResult(Tds.java:1947)
[java] [java] at com.sybase.jdbc2.jdbc.ResultGetter.nextResult(ResultGetter.java:6

at com.sybase.jdbc2.jdbc.ResultGetter.nextResult(ResultGetter.java:69)
[java] at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:204)
[java] at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:204)
[java] at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:187)
[java] at com.sybase.jdbc2.jdbc.SybStatement.updateLoop(SybStatement.java:1615)
[java] at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:187)
[java] at com.sybase.jdbc2.jdbc.SybCallableStatement.executeUpdate(SybCallableStatement.jav

[java] at com.sybase.jdbc2.jdbc.SybStatement.updateLoop(SybStatement.java:1615)
[java] at com.un.imis.common.TransactionManager.utTransactionManager.executeProcedure(utTra


Its critical for us to get this exception, so that we can show proper message
to the user.

mayur

unread,
Jan 16, 2004, 8:48:23 AM1/16/04
to

we solved this problem by catching SQLWarning before SQLException becuase its a
subclass of SQLException.

catch(SQLWarning warn)
{

}
catch(SQLException ex)\
{

}

mayur

unread,
Jan 16, 2004, 8:48:23 AM1/16/04
to

mayur

unread,
Jan 16, 2004, 8:51:40 AM1/16/04
to

We solved this problem by using following code:

catch(SQLWarning warn)
{
warn.printStackTrace();
SQLException warn1 = warn.getNextException();
if(warn1 != null)
{
// this is real exception that is trwon by the SQL trigger and needs to be caught
to extract error message.
}

}
catch(SQLException e)
{
// this is as usual.
}

0 new messages