This project has moved and is read-only. For the latest updates, please go here.

Create a database in any directory

Jul 26, 2011 at 7:04 PM


I would like to create my server database in a directory of my choice, not the AppData.

I tried:

var fs = new FileSystemDriver("SimpleTest", null, null, "C:\\Temp\\test_sterling");

But Sterling does not accept it (it raises an exception about the path when I call RegisterDatabase).
Personally, I see no reason to prohibit this directory or any one else. Windows already has security measures to protect directories, that should be enough.

Of course, I could modify the source code of Sterling, or use the Backup and Restore procedures, but it is unsatisfactory.

Or maybe I am wrong and there is another method I did not see ?

If somebody has a solution, he will be welcome. :)

Thank you

Jul 27, 2011 at 1:25 PM

Currently the purge process recursively walks the sub directories and removes files and folders. This would be disasterous if someone accidentally configured a folder to be, say, c:\root. Sterling will follow guidance/best practices for limiting the location "out of the box" to the scope of the application. It would be more unsatisfactory if someone pulled down the bits to "toy with them" and suddenly found their hard drive completely wiped clean. As you noted, the source and license allow you to modify this however you see fit.

Jul 27, 2011 at 1:51 PM

Thank you for the explanation.

Your reply explains why I usually do not modify the source code of a big project: without a deep knowledge of the code, consequences can be disastrous, very easily.

In this particular case, I suggest to modify the Purge process to make it more secure (only delete the database files), and consequently allow any database location.

For now, I will adapt my program.
Thank you for your help and nice library.  :)

Jul 27, 2011 at 1:58 PM

Absolutely - and I agree with your suggestion to improve the purge process. I appreciate your use and involvement with the project!