Showing posts with label oledb. Show all posts
Showing posts with label oledb. Show all posts

Sunday, March 25, 2012

Do I need these OLEDB properties when opening a database?

Howdy folks!

If I set the following three properties when creating a database, do I need to set the same properties when I open the same database later?

sscedbprop[0].dwPropertyID = DBPROP_SSCE_AUTO_SHRINK_THRESHOLD;
sscedbprop[0].dwOptions = DBPROPOPTIONS_REQUIRED;
sscedbprop[0].vValue.vt = VT_I4;
sscedbprop[0].vValue.intVal = 100;

sscedbprop[1].dwPropertyID = DBPROP_SSCE_MAX_DATABASE_SIZE;
sscedbprop[1].dwOptions = DBPROPOPTIONS_REQUIRED;
sscedbprop[1].vValue.vt = VT_I4;
sscedbprop[1].vValue.intVal = 4091;

sscedbprop[2].dwPropertyID = DBPROP_SSCE_ENCRYPTDATABASE;
sscedbprop[2].dwOptions = DBPROPOPTIONS_REQUIRED;
sscedbprop[2].vValue.vt = VT_BOOL;
sscedbprop[2].vValue.boolVal = (a_bEncrypted==TRUE)?VARIANT_TRUE:VARIANT_FALSE;

Thanks!

BTW, why is the max size not 4096?

The first two properties can vary from session to session, but not the third. When you create a database with encryption, it must always be opened with that property (AFAIK). The auto shrink threshold and max database size have no impact on the database file format and thus don't persist.

The 4096 vs 4091 question also baffles me...

|||Awesome, thanks Joao.

Tuesday, February 14, 2012

Distributed Transaction

I am trying to access a table in another server and I keep getting this error msg.
'THE OLEDB provider was unable to begin a distributed transaction'
I have a linked server and I am using Microsoft OLE DB Provider for SQL Server.
Anyone can help?can you give an example as to the way you are trying to access the other table on the 'b' server?

What T-SQL statement are you trying to use?|||I was trying to INSERT. Does that only work for SELECT?!|||Basically i was trying to use the statement below where AP2K380 is my linked Server.

insert into AP2K380.asiapac702_test.dbo.tblCustServiceHistoryH dr

and I ran into an error saying that the SQLOLEDB was unable to being a distributed transaction.

Pls help...thanks a million!