Page 1 of 1

Settig SQL Server CE 'max database size'

Posted: Tue 29 Jul 2008 17:55
by jyarnot
I am trying to set the 'max database size' attribute for a SQL Server ce database. From what I understand, this is done by passing the desired maximum size (in MB) on the connection string to the CE database. When I open the database in MS SQL Server Management Studio Express, I have an advanced option to set this and it affects all subsequent, concurrent connnections (only the first one in gets to set max size). So if I open the DB there first, then run my app, it works fine. If I don't, I hit the default limit of 256 MB. I have tried setting it as a parameter to my TSQLConnection object (params.add('max database size=2048')) but that seems to have no effect. I'm not sure if this is a TSQLConnection issue, or a driver issue or I'm just not doing it right, but since the only way I've found to connect to MS SQL CE databases is using Devart, I thought I'd start by asking here.

Here's a code snippet showing how I'm setting the attributes:

cnMain.DriverName := DriverName;
cnMain.GetDriverFunc := GetDriverFunc;
cnMain.LibraryName := LibraryName;
cnMain.VendorLib := VendorLib;
cnMain.Params.Add('max database size=2048');

cnMain is my TSQLConnection and aside from the size issue, everything works. Any help, insight or direction would be appreciated. Thanks.

Posted: Fri 01 Aug 2008 17:32
by jyarnot
I tried it without the TSQLConnecion. Using Data Explorer in the IDE, I clicked 'Modify Connection' and then 'Advanced' then right-click in the misc area of the Advanced Properties page and choose 'Add'. I then add a property named 'max database size' and set it to 2048 (my db is 1016 MB). After that, I can see that my connection string at the bottom of the screen now shows the value set as I'd hoped, but I still get the same error. So, now I'm thinking it's a Devart issue.

Posted: Thu 07 Aug 2008 09:00
by Dimon
Now dbExpress driver for MS SQL Server does not provide feature to set the 'max database size' attribute, but we will support such functionality in the next DbxSda build.

How to access this functionality

Posted: Tue 26 Aug 2008 17:59
by jyarnot
I see that this is now in the latest build, but I don't see anything in the documentation that shows how to use it. My attempts at the obvious were unsuccessful.

Posted: Thu 28 Aug 2008 13:12
by Dimon
To set the 'max database size' attribute for a SQL Server CE database, you should set appropriate parameter of TCRSQLConnection, like this:

Code: Select all

  TCRSQLConnection.Params.Values['Custom String'] := 'MaxDatabaseSize=2048';