Re: Database path from DSN (MSDE) (2nd. attempt)
- From: Peter Scholl <delete.this.pscholl@xxxxxxxxxxx>
- Date: Wed, 22 Jun 2005 18:21:00 +0200
Tim,
Unfortunately only the local path of the db on the server is returned
(d:\databases\TestDB.mdf), I don't get multiple paths. However, if I
put the name of the server obtained from the registry (or other APIs)
in front, and remove the ":" I can construct the path. I'll experiment
with this idea and am thankful for your reply.
>Now comes the question: Why on earth would you want to know that in a client
>application?
Well, maybe there's a better solution, but my application has to be
*extremely* simple from the maintenance, installation and operation
point of view. i.e. 100% maintenance free and I need to lock the DB -
here's a rather lengthy explanation why.
An "End-of-Day" is selected manually every day (very often by someone
with absolutely no IT experience) and the DB must be locked for about
5-15 minutes for the automated daily postings and internal date change
etc. Since there's no way to manually lock the DB (I use ODBC, no DAO)
I use the old "lockfile" trick with a file located in the same path as
the DB. This is opened in exclusive mode during the EOD and shared
mode in all other cases. This is why I need the full path to the DB.
If you know of a better solution that would work on Access97+ *and*
MSDE I'm open to ideas.
BTW, the application runs on Win98 upwards. It is *not* client/server
but all workstations communicate real-time with each other using
socket connections. Works on single pc, peer-to-peer or domain.
Thanks again for your reply,
Peter
On Wed, 22 Jun 2005 20:01:35 +1200, "Tim" <Tim@NoSpam> wrote:
>The path is in the master database... There can be multiple paths...
>
>try running a query as follows:
>
>select filename from master..sysdatabases where name = 'your db name'
>
>Now comes the question: Why on earth would you want to know that in a client
>application? This tends to indicate to me that you are possibly not using
>the right tool for the right job. Nothing on the client side needs to know
>this and should not know this for normal applications (security) ==> not a
>normal application.
>
>- Tim
>
>
>
>"Peter Scholl" <delete.this.pscholl@xxxxxxxxxxx> wrote in message
>news:9v1ib1dh7ogt3059pr9sn8nhh3j1v1k2mb@xxxxxxxxxx
>> I'm trying to get the full path of my .mdf database from a DSN on a
>> shared WinXP drive (running MSDE).
>> I've tried the following: (using MFC6, SP6)
>>
>> SQLGetInfo(g_db.m_hdbc, SQL_DATABASE_NAME, &sMyDatabase, lSize,
>> &bytesreturned);
>> SQLGetConnectAttr(g_db.m_hdbc, SQL_CURRENT_QUALIFIER, &sMyDatabase,
>> lSize, &lLengthReturned);
>> SQLGetConnectAttr(g_db.m_hdbc, SQL_ATTR_CURRENT_CATALOG,
>> &sMyDatabase, lSize, &lLengthReturned);
>>
>> All the functions return the name of the database but not the path.
>> The path is not in the registry so I can't use those functions either.
>> Any help would be very much appreciated
>
.
- Follow-Ups:
- References:
- Database path from DSN (MSDE) (2nd. attempt)
- From: Peter Scholl
- Re: Database path from DSN (MSDE) (2nd. attempt)
- From: Tim
- Database path from DSN (MSDE) (2nd. attempt)
- Prev by Date: Re: How to hide project's implementation files
- Next by Date: Re: How to hide project's implementation files
- Previous by thread: Re: Database path from DSN (MSDE) (2nd. attempt)
- Next by thread: Re: Database path from DSN (MSDE) (2nd. attempt)
- Index(es):
Relevant Pages
|