Re: SQLNCLI is not allowing CREATE DATABASE inside a TRansaction
- From: Erland Sommarskog <esquel@xxxxxxxxxxxxx>
- Date: Mon, 29 May 2006 22:07:52 +0000 (UTC)
(zunilp@xxxxxxxxx) writes:
Thanks for the reply.
But in the real programming world, this is not true.
I can prove that using a microsoft tool or some test program using
OLEDB or JDBC.
Example
If you use RowsetViewer supplied by microsoft,
with SQLOLEDB(my mdac is 2.8 sp1), Inside a trnsaction you can
successfully call CREATE DATABASE.
No:
BEGIN TRANSACTION
go
CREATE DATABASE holger
go
ROLLBACK TRANSACTION
This yields:
Server: Msg 226, Level 16, State 5, Line 1
CREATE DATABASE statement not allowed within multi-statement transaction.
What may heppen with SQLOLEDB is that it under some circumstances can
open a second connection to SQL Server behind the back. This will
typically happen if you initiate a new operation on your session object
before you have picked up all result sets. If that second connection is
not part of the transaction, your CREATE DATABASE will pass. But, obviously,
if you rollback, the database will still be there, because it was
created outside the transaction.
The same tool if you use with SQLNCLI, it will throw back error
mentioned by me.
SQLNCLI should also be able to open a second connection, but your case
may be one where they plugged a hole which caused SQLOLEDB to open a
transaction.
I'm not acquainted with the rowset viewer you mention, so I can't test
with it.
The same thing can be reproduced using a java-jdbc program. I you wish
I can post that some test program using JDBC
Behaviour is totally different.
Java and JDBC is completely foreign land to me.
--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.
- References:
- SQLNCLI is not allowing CREATE DATABASE inside a TRansaction
- From: zunilp
- Re: SQLNCLI is not allowing CREATE DATABASE inside a TRansaction
- From: Erland Sommarskog
- Re: SQLNCLI is not allowing CREATE DATABASE inside a TRansaction
- From: zunilp
- SQLNCLI is not allowing CREATE DATABASE inside a TRansaction
- Prev by Date: Re: SQLNCLI is not allowing CREATE DATABASE inside a TRansaction
- Next by Date: Re: Query Builder parameter problem
- Previous by thread: Re: SQLNCLI is not allowing CREATE DATABASE inside a TRansaction
- Next by thread: Re: C++, OLEDb, Bulkcopy
- Index(es):
Relevant Pages
|