473,385 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

SQLSTATE 25501 invoking SPs from a J2EE DataSource connection

We are running into some problems with the execution of DB2 stored
procedures when their isolation level is set to:

set transaction isolation level READ UNCOMMITTED, READ WRITE;

This is a web application running in JBoss 4.0.1 where a standard
DataSource in JBoss is defined for connections against a DB2 database
on an AS/400 (VRM = V5R2M0). The driver is established as: <driver-
class>com.ibm.as400.access.AS400JDBCDriver</driver-class>, we are
using JTOpen 5.4.

The data source provides connections fine, we ask the data source to
give us a connection and then the connection is used to invoke a
Stored Procedure. On most stored procedures this works fine since most
of them read information but when two procedures that modify the DB
with inserts or updates are invoked in a row the second procedure does
not run and reports an 25501 error.

According to DB2 documentation this is associated to:

"SQL0428N DISCONNECT cannot be issued if a connection it is directed
against has executed SQL within the unit of work.
Explanation: DISCONNECT will not be executed against a connection in
the following cases:
If SQL has been issued against the connection within the unit of work.
sqlcode: -428
sqlstate: 25501"

If we use a direct JDBC connection for each SP invocation we do not
get this error, it is when its called with the DataSource connection
that this error happens. We can't afford a new connection for every SP
we have to invoke because the AS/400 slows way down when a lot of
connections are requested and this is a very active system.

The SP that does inserts/updates set their isolation level with the
following settings:

set transaction isolation level READ UNCOMMITTED, READ WRITE;

Has anybody had this problem? and better yet: how was it solved?

Thanks.

Jun 13 '07 #1
1 3686
ha*******@gmail.com wrote:
We are running into some problems with the execution of DB2 stored
procedures when their isolation level is set to:

set transaction isolation level READ UNCOMMITTED, READ WRITE;

This is a web application running in JBoss 4.0.1 where a standard
DataSource in JBoss is defined for connections against a DB2 database
on an AS/400 (VRM = V5R2M0). The driver is established as: <driver-
class>com.ibm.as400.access.AS400JDBCDriver</driver-class>, we are
using JTOpen 5.4.

The data source provides connections fine, we ask the data source to
give us a connection and then the connection is used to invoke a
Stored Procedure. On most stored procedures this works fine since most
of them read information but when two procedures that modify the DB
with inserts or updates are invoked in a row the second procedure does
not run and reports an 25501 error.

According to DB2 documentation this is associated to:

"SQL0428N DISCONNECT cannot be issued if a connection it is directed
against has executed SQL within the unit of work.
Explanation: DISCONNECT will not be executed against a connection in
the following cases:
If SQL has been issued against the connection within the unit of work.
sqlcode: -428
sqlstate: 25501"

If we use a direct JDBC connection for each SP invocation we do not
get this error, it is when its called with the DataSource connection
that this error happens. We can't afford a new connection for every SP
we have to invoke because the AS/400 slows way down when a lot of
connections are requested and this is a very active system.

The SP that does inserts/updates set their isolation level with the
following settings:

set transaction isolation level READ UNCOMMITTED, READ WRITE;

Has anybody had this problem? and better yet: how was it solved?
If this is still unresolved and -428 is returned from the server, below
is some message detail (from V5R4M0 VRM). If the connection is not at a
commit boundary when SP1 calls SP2 (and SP2 issues SET TRANSACTION..)
that might be the cause.

===wrkmsgd sql0428 qsqlmsg
Message ID . . . . . . . . . : SQL0428

Message file . . . . . . . . : QSQLMSG

Library . . . . . . . . . : QSYS

Message . . . . : SQL statement cannot be run.

Cause . . . . . : The statement cannot be run in the current
application state. A SET TRANSACTION, DISCONNECT, or SET SESSION
AUTHORIZATION statement was encountered and a connection is not at a
commit boundary.
A SET SESSION AUTHORIZATION statement was encountered and one of
the
following has occurred:

-- The SYSTEM_USER is one of the system-supplied user profiles such
as QSYS, QDFTOWN, or QSPL.

-- The current server is a local relational database and there is
an
active connection to a remote relational database.

-- A stored procedure, user-defined function, or trigger is
running.
-- Resources are being held because a COMMIT HOLD or HOLD LOCATOR

statement has been run.

-- The maximum number of ProfileHandles have been generated.

Recovery . . . : Do one of the following actions prior to running the
SQL statement. Try the request again.

-- If the connection is not at a commit boundary, issue a COMMIT or

ROLLBACK SQL statement.

-- If connections to remote relational databases are active,
disconnect the remote connections.

-- If the SYSTEM_USER is one of the system-supplied user profiles,
sign-on with a different user profile.

-- If resources are being held because a COMMIT HOLD has been run,
issue a COMMIT or ROLLBACK SQL statement.

-- If resources are being held because a HOLD LOCATOR has been run,
issue a ROLLBACK or FREE LOCATOR SQL statement.

-- If the maximum number of ProfileHandles have been generated,
release some of the ProfileHandles that are no longer needed using the
Release ProfileHandle (QSYRLSPH) program.
--
Karl Hanson
Jun 18 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Srinivas B.S.S | last post by:
Hi, I am using MyODBC 3.51.06 on solaris. When a ODBC call fails to execute due to communication problems with database server, according to ODBC reference, sqlstate should be set to 08S01...
25
by: MuZZy | last post by:
Hi, I'm currently rewriting some functionality which was using multithredaing for retrieving datasets from database and updating a grid control. I found that the grids (Infragistics UltraGrid,...
0
by: Nasir | last post by:
What do we need to do to make the connection to SQL Server 2005 via JNDI? Here is what is happening: Verifying JNDI binding Datasource properties: description=empty
1
by: Newie | last post by:
Hi, I have installed the Run Time Client Lite on a WIn XP computer for the ODBC driver and it works fine, I get an connection. When I installed the Client on a Win2000 computer I get this error...
5
by: alingsjtu | last post by:
Hello, every body. When execute dynamic generated multiple OPENQUERY statements (which linkes to DB2) in SQLServer, I always got SQL1040N The maximum number of applications is already connected...
2
by: uday123 | last post by:
Hi, We are using DB2 in an enterprise J2EE application and extracting data from here. But i get the following exception when i try to retriece records from this database: ...
3
by: vijay.db | last post by:
Hi Group, Getting the below error in AIX server 5.2 and my DB2 ESE is V8.1 and Fixpack 11. I'm able to successfully connect to the database and able to run a SELECT query with out any...
0
by: carj2ee | last post by:
Hi, I have a J2EE application connecting to a mainframe DB2. I am getting the following exception in my application:- SQLCODE: -904, SQLSTATE: 57011, SQLERRMC:...
4
by: Pool | last post by:
I tried to connect DB2 (Sitting in Unix server at my client location) using Db2 connect V8. I am getting the following error message. I tried all the possible options BUt the error is same.. See each...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.