Telling if a database is stored locally or on a server


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Telling if a database is stored locally or on a server

Hybrid View

  1. #1
    Join Date
    Nov 2005
    Posts
    11

    Telling if a database is stored locally or on a server

    I am new to a job and doing enhancements to a sytem they have. The problem I am having is coming up with a way to tell if a database is being stored on a local machine or on a server. We use an .ini file to point to the database and have some problems with people having the file pointing to a local database instead of one on the server. I need to make a procedure that will test to see if the file is stored locally or not. I know that there is a register Netclient and if it is true then they are running a on a server but I dont know how to test if the database is stored there. Any help please

    Thank you
    DrunkenMunk

  2. #2
    Join Date
    Nov 2003
    Location
    Alameda, CA
    Posts
    1,737
    which database?
    Marco
    "There are two ways to write error-free programs. Only the third one works."
    Unknown

  3. #3
    Join Date
    Nov 2005
    Posts
    11
    the database is called common.mdb but it matters where it is located not what it is named. I am just looking for a way to tell if the database path is local or on a server. I know how to parse a the string to get what the path starts with but that will not help with finding out where the file is located. I need to be able to warn the people that they are not using the correct database if they are using one stored locally and are running the program on there server

    Thanks again

  4. #4
    Join Date
    Nov 2003
    Location
    Alameda, CA
    Posts
    1,737
    what I meant is Access, Oracle, Sql etc.
    because the database is in a file am I correct thinking that you use Access?

    Marco
    "There are two ways to write error-free programs. Only the third one works."
    Unknown

  5. #5
    Join Date
    Nov 2005
    Posts
    27
    If I understand correctly, you use an Access database and you share the file over the network. I assume that you need to know if the drive specified in the path from the configuration file is a mapped network drive.

    Then what you need is this Windows API function:

    Code:
    Const DRIVE_REMOVABLE = 2
    Const DRIVE_FIXED = 3
    Const DRIVE_REMOTE = 4
    Const DRIVE_CDROM = 5
    Const DRIVE_RAMDISK = 6
    
    Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
    I assume you know what to do next.

Similar Threads

  1. Replies: 0
    Last Post: 11-30-2001, 09:35 PM
  2. Returning errors from SQL Server Stored Procs
    By Khalizan in forum VB Classic
    Replies: 1
    Last Post: 11-28-2001, 02:32 AM
  3. Replies: 1
    Last Post: 05-10-2001, 09:30 AM
  4. A Stored Procedure Bogging down the Server
    By Merrill Nelson in forum authorevents.vieira
    Replies: 2
    Last Post: 01-25-2001, 01:00 AM
  5. Replies: 0
    Last Post: 06-27-2000, 07:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center