all groups > sql server odbc > august 2004 >
You're in the

sql server odbc

group:

Driver caching db??


Re: Driver caching db?? Brannon Jones
8/17/2004 2:49:05 PM
sql server odbc:
The driver does not touch the database file directly. The SQL Server
process will open (and lock) the database file.

Is the database hosted in a different SQL instance, than the one you are
connecting to in Enterprise Manager?

Brannon

[quoted text, click to view]
Driver caching db?? JohnD
8/17/2004 3:23:57 PM
Hello,

I'm not sure if this message belongs in microsoft.public.sqlserver.msde
or is more appropriate here. Please accept my apologies if I have the
wrong list.

I've written ODBC source in C++ that accesses an MSDE instance on a
local machine. I perform the usual steps:

1. Allocate an SQLHENV
2. Allocate the SQLHDBC
3. Connect
4. Execute a statement to "use " my database
5. Issue a simple query
6. Process results
7. Disconnect SQLHDBC
8. Free SQLHDBC
9. Free SQLHENV
10. Exit application

Then I try to attach to the database in SQL Server Enterprise Manager
which returns the following error:

"Error 5123: CREATE FILE encountered operating system error 32 (The
process cannot access the file because it is being used by another
process.) while attempting to open or create the physical file:
'C:\mydb.mdf'.

Do I need to do something different to force the driver to unload the
database when the application ends?

Thanks,
Re: Driver caching db?? Brannon Jones
8/17/2004 5:54:23 PM
I don't think you can attach a single database to two different SQL
instances. The first instance that loads the database locks it for
exclusive access. So the second instance that tries to load the database
wont be able to.

Brannon

[quoted text, click to view]
Re: Driver caching db?? JohnD
8/17/2004 9:52:09 PM
[quoted text, click to view]

Yes it is. I'm assuming (really I didn't know this...) that this makes
a different?

The application is using a default SQLSERVER instance and the attaching
Re: Driver caching db?? John Dubchak
8/18/2004 12:00:06 PM
[quoted text, click to view]

Which explains why I have to stop the instance in order for the other
instance to attach to it.

AddThis Social Bookmark Button