Database is already open and can only have one user...

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Antero
Posts: 1
Joined: Tue 22 Jul 2008 11:36

Database is already open and can only have one user...

Post by Antero » Tue 22 Jul 2008 14:10

SDAC 4.50.0.35
Delphi 2006

I try to update database. First I set database option SINGLE_USER, then I try to run hundreds of SQL commands. I use only one TMSConnection. After a few minutes of updating comes sometimes the exception "Database 'updatetest' is already open and can only have one user at a time." This exception is not dependent on last command, it is totally random.

Do you have any idea why this exception comes?

Thanks,
Antero

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Wed 23 Jul 2008 07:09

Probably the error happens when SDAC tries to establish additional connections to the server (e.g. FetchAll=False mode, NonBlocking=True mode). Try to enable the MultipleActiveResultSets option in TMSConnection. See description of MultipleActiveResultSets in the SDAC help.

Post Reply