Only a single store for Database Connection Wizard data???


Author
Message
Sam Tenney
Sam Tenney
StrataFrame User (140 reputation)StrataFrame User (140 reputation)StrataFrame User (140 reputation)StrataFrame User (140 reputation)StrataFrame User (140 reputation)StrataFrame User (140 reputation)StrataFrame User (140 reputation)StrataFrame User (140 reputation)StrataFrame User (140 reputation)
Group: StrataFrame Users
Posts: 70, Visits: 3.5K
I am still a beginner and so I am not sure if the problem I am seeing was caused by something I did wrong or if my complaint is valid, but here is what I am seeing.

While learning StrataFrame I create lots of little applications to test various things.  These applications access lots of different test databases and tables.  Today I made a mistake when I first launched a new test application.  I mistakenly chose the wrong database and table when the Database Connection Wizard ran.  Les Pinter's article showed me how to delete the Connections.dat file and the AppKeys.dat file to force the Database Connection Wizard to run again.  That did cause the wizard to run again, but I was surprised that now the wizard must be run for every test application that I have previously created and for which I have already completed the wizard.

To my surprise I discovered there is only one pair of Connections.dat and AppKeys.dat files that are used by all the applications I have ever run.  And I was surprised to find those files under the Documents and Settings\All Users\... folder on my Windows XP system rather than under my personal documents folder.

Did I do something wrong?  Shouldn't these files relate to only one application?

Sam Tenney

Reply
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
After posting my first answer, I started to ponder the issue some more. SF tends to build things so you aren't so pigeon holed into a specific implementation, so I did some more research into how the ConnectionManager works and it turns out there are some other, more elegant solutions.



First, there is a static (shared) property of the ConnectionManager that allows you to change the folder were the data files are stored. They don't have to be stored in the default location. You can have a set of files for each app if you wish. For test apps you might want to just put the data files right in the app folder. You'd add this before calling SetConnections:



VB

ConnectionManager.ConnectionDataFolder = Application.StartupPath()




C#

ConnectionManager.ConnectionDataFolder = Application.StartupPath;




Now, the AppKeys.dat and Connections.dat will be just for that app in the same folder as the executable (/bin/Debug typically).



A second alternative (for test apps) is to share an application key between apps (not to be confused with the SF shared settings). To understand this approach, I'll explain how I might use this.



I have a folder I use for all my test apps (the ones I want to keep anyway), E:\Research. Under this folder I then have folders for the samples. E.g. I have a AppSessionTest folder that contains a solution where I tested how the application session handling works in SF. I tend to use the StrataFrameSample database for most of these apps if they need data. For any app that needs to use the SF sample db, I could add the following to my SetDataSources() method:



//-- Use common connection data folder for research projects.

ConnectionManager.ConnectionDataFolder = @"E:\Research\ConnectionData";



//-- Use the common app key for the SF sample db.

ConnectionManager.ApplicationKey = "StrataFrameSampleData";




Once I've run one app that sets up the connection to my StrataFrameSample database using this App key and using the datafiles under my ConnectionData folder, all others won't need to prompt me at all. Kind of cool.



Note that I'd likely only use this with projects that only used just the sample db. If the solution was using multiple, I'd use a unique app key and maybe put the connection data in the app folder.



I hope this helps ease some of the pain you've had to experience. I know it will help me in a bunch of situations. Thanks for asking the question!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search