You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by Matthias Roth <ma...@impart.ch> on 2003/12/17 23:13:59 UTC

FW: additional function for PlatformDb2Impl


Hi Thomas
I had added the function getLastInsertIdentityQuery to the class
PlatformDb2Impl.
This call is testet and works for DB2 Version 7.x (z/OS) and 8.x (NT):
// matthias.roth@impart.ch
//the function is used by the
org.apache.ojb.broker.util.sequence.SequenceManagerNativeImpl
//this call must be made before commit the insert cammand, so you
//must turn off autocommit by stting the useAutoCommit="2"
public String getLastInsertIdentityQuery(String tableName)
{
return "select IDENTITY_VAL_LOCAL() from sysibm.sysdummy1";
}

and

to the class PlatformMsSQLServerImpl:

// matthias.roth@impart.ch
//the function is used by the
org.apache.ojb.broker.util.sequence.SequenceManagerNativeImpl
//this call must be made before commit the insert cammand, so you
//must turn off autocommit by stting the useAutoCommit="2"
public String getLastInsertIdentityQuery(String tableName)
{
return "SELECT @@IDENTITY AS id FROM "+tableName;
}

regards

Matthias Roth
Dipl. Ing. HTL
in Wirtschaftsinformatik

impart Software Engineering GmbH
Chasseralstrasse 13
Postfach
CH-3063 Ittigen

Phone           +41 (0)31 922 39 25
Fax             +41 (0)31 922 39 18
EMail           mailto:matthias.roth@impart.ch
Homepage        http://www.impart.ch