Newsgroups: comp.databases.oracle.misc Path: dp-news.maxwell.syr.edu!spool.maxwell.syr.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!wns13feed!worldnet.att.net!4.24.21.153!newsfeed3.dallas1.level3.net!news.level3.com!news.sanjose1.Level3.net!Level3.net!news.indiana.edu!news.er.usgs.gov!news From: Brian Peasland Subject: Re: Duplicate transaction In-Reply-To: <1152777184.479427.4820@b28g2000cwb.googlegroups.com> X-Nntp-Posting-Host: edc-cv-160-56.cr.usgs.gov Content-Type: text/plain; charset=ISO-8859-1; format=flowed Message-ID: User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) Sender: news@igsrsparc2.er.usgs.gov (Janet Walz (GD) x6739) Content-Transfer-Encoding: 7bit Organization: U.S. Geological Survey, Reston VA References: <1152630595.488981.287350@m73g2000cwd.googlegroups.com> <1152691962.783562.216820@m79g2000cwm.googlegroups.com> <1152715666.773174.139430@m73g2000cwd.googlegroups.com> <1152777184.479427.4820@b28g2000cwb.googlegroups.com> Mime-Version: 1.0 Date: Thu, 13 Jul 2006 15:57:25 GMT Lines: 64 Xref: dp-news.maxwell.syr.edu comp.databases.oracle.misc:128508 > Yes, > cause may happen that one or more clients not developed from me, start > trasactions and set XIDs. In all my years working with Oracle, I've never once had to set a transaction id. And I cannot think of a reason where I would need to do such a thing. Like I said before, Oracle is pretty good at managing transactions for you....in all but the rarest of circumstances, let Oracle do that job for you. Just because you can....does not mean you should.... If I were using applications that explicitly set a transaction id, then I'd go back to the application vendor or application developer and tell them to give me code that does not do this. Otherwise, as you have seen, their application may not work correctly. This is an application issue, not a database issue so the *fix* needs to go into the application vendor/developer's hands. > We'd like to prevent that two clients set the same XID; I made some > test and Oracle stops the transaction if one XID has just been used. I have no idea how you can prevent this other than to stop the code from explicitly setting the XID. If two clients were to set the same XID, then the only way to stop this is in the application code, not in the database. > We tried to set another transaction code: if we receive a request to > start a transaction and a XID from the client, we set another > trasaction code. This goes well. But if something wrong happens and a > transaction was not completed, we lost the transaction code, but we > have the XID (I don't know if I'm clear). So we'd like not to use the > transaction code and use only th XID, but to avoid to have duplicate > XID from different client, or if this happens, that Oracle manages it. Why do you care about the transaction code or XID here? If you dont set it, dont worry about it....Oracle will handle everything for you. If the transaction was not completed, don't worry about it...when a new transaction starts, Oracle will handle the transaction for you. If you choose to take matters into your own hands, you'll have to handle all of the things that Oracle handles for you quite nicely! I guess I do not know how to be more clear other than to politely say that you should not explicitly set the XID in your code. Doing so is a bad idea, as you have seen. One should only do this sort of thing if they have a specific need that the database does not meet for them. And making this determination should only be done once one *fully*, *completely*, and *thoroughly* understands Oracle transaction model. Cheers, Brian -- =================================================================== Brian Peasland dba@nospam.peasland.net http://www.peasland.net Remove the "nospam." from the email address to email me. "I can give it to you cheap, quick, and good. Now pick two out of the three" - Unknown