× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




Have Web app that reads record from iSeries to get a unique number, then
deletes that record.

Need to make sure that only one web user gets that unique number.

Application seems to work 99% of the time but sometimes log reports
duplicate key error message when using
unique number to write to transaction file. This seems to suggest that
more than one user retrieved the
unique number.

I use SQL to access the iSeries, setting the connection to
TRANSACTION_SERIALIZABLE to lock the record.

Appreciate any help on this issue.

Many thanks.

Below is the code :

sqlSelect="SELECT AMMBR# FROM MBPRDDTA.MBAMBRP WHERE AMGRWS= ? FOR
UPDATE";
try{
con=AS400ConnectionManager.getInstance().getConnection();
con.setTransactionIsolation
(Connection.TRANSACTION_SERIALIZABLE);
psmt=con.prepareStatement(sqlSelect);
psmt.setString(1,memberData.getTradeIndividual());
ResultSet rs=psmt.executeQuery();
rs=psmt.executeQuery();

if(rs.next()){
response.setMemberNumber(rs.getLong("AMMBR#"));
if (deleteMemberNumber(response.getMemberNumber
(),con)){
response.setStatus
(ApplicationStatus.SUCCESS);
response.setMessage("Successfully retrieved &
deleted member number from MBAMBRP");
}
}
con.commit();


}catch (SQLException e){
response.setMessage("SQL exception : Error retrieving &
deleting member number from MBAMBRP");
e.printStackTrace();
} catch (PersistenceException e) {
response.setMessage("Persistence exception : Error
retrieving & deleting member number from MBAMBRP");
e.printStackTrace();
}
finally{
try {
psmt.close();
con.close();
} catch (SQLException e) {
response.setMessage("SQL final exception : Error
retrieving & deleting member number from MBAMBRP");
e.printStackTrace();
}
}


***********************************************************************************

CONFIDENTIALITY / DISCLAIMER NOTICE

This communication contains information which is confidential and may also be privileged.
It is for the exclusive use of the recipient(s). If you are not the intended recipient(s)
please note that any distribution, copying or use of this communication or the information
in it is strictly prohibited.
Any views or opinions presented are solely those of the author and do not necessarily
represent those of Costco Wholesale UK Ltd. If you have received this communication in
error please notify us by e-mailing the author or by telephoning (01923 213113) and then
delete the communication and any copies of it.
This communication is from Costco Wholesale UK Ltd whose registered office is at UK Home Office,
Hartspring Lane, Watford WD25 8JS, England.

***********************************************************************************

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.