Subject Re: Database Location Query
Author homerjones1941
> And is there any particular reason that it has to be a subdirectory?

Yes. The subdirectory stores image files (.BMP, .JPG, etc) for a document storage and retrieval system. In the past I have not stored the image binaries in the database even though a blob field could accommodate them. My original design (15 years ago) did that, and it proved to be problematic with the volume of image data. The industry I work with is very document oriented, and the number of image files increases greatly over time. Insurance Law requires all documents to be saved for 3 to 5 years, depending on the State (State law, not US law). When it is finally okay to destroy the documents, it is easier to simply delete a folder named "2005" than it is to delete each file for that year. So the subdirectory I'm referring to has its own set of subdirectories Like: C:\ApplicationDir\DocumentDir\2005\January.

I've done it this way for over 15 years, and it works quite well. Besides, if I were to change that procedure now, I would have to rewrite a lot of code.

Okay, to get back to the original question. My users can install the database on any drive letter they wish (on the server). With the encouragement of the Group, I decided to use Aliases instead of forcing my users to identify the data path (great idea). Aliases make it easier for my users to install the client software, but unfortunately, the alias doesn't tell my application where the data folder is, and it needs to know that so it can place scanned images in the correct subdirectory.

It would be nice to do the query I asked about, but I have alternate solution. Since my installation puts the Client Library location in the Server Computer's registry, I know it is in the Firebird\BIN subdirectory, which is on the same drive as the database. Since I know the name of the data folder, I can parse the drive letter from the Client Library path, and construct the path to the database. It's the hard way around, but I've written a small function that returns what I need from the server's registry. Obviously, the Server Computer must be up, or the function returns a "shame on you" message.

I've probably over-answered your question, but maybe someone will have an easier way. It would be nice to query the database to say: Where are you? I could store the data location in a record withing the database, but I think it is easier to query the remote registry than it is to edit the database at install time.

I'm always open to suggestions.