The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

User-configurable connection strings

Having formerly done in-house development, I never worried about connection strings at installation time. I just hard coded them. For the rare cases when they weren't hard coded, we gave the users instructions on how to set up DSN files.

Are DSN's still used, or is there a better way to setup connection strings for packaged client-server applications?
Cowboy coder
Tuesday, February 22, 2005
If it's a packaged application, you should ask where to install the database, and in that case you already know what the connection string should be.

Tuesday, February 22, 2005
That would make sense if the app would be installed on only one machine. How's it typically done when installing on multiple machines?

I was thinking in terms of a installation text file in which a sys admin could enter the connection string.  Since .Net config files are read only at run time, the config file (where I planned on storing the connection string) would need to be generated from scratch by the installer.

Is there an easier way?
Cowboy coder
Tuesday, February 22, 2005
First you install it on the server, and then the installation creates a share (or another zip, msi, whatever) for the client installation AND this new msi can be used on the client, this new msi contains the server address, so no need to configure on the client.

Actually this is how Devtrack, a bug database did it 6 years ago.

Wednesday, February 23, 2005
Excellent no name. Just the kind of advice I was looking for. Thanks.
Cowboy coder
Wednesday, February 23, 2005
And if your server name changes... ??
Wednesday, February 23, 2005
Universal Data Link file

Look at MSDN for more info, but basically its a file containing your Provider=... string.

Quick test: create a new text file on your pc. Rename it to eg test.udl. The icon will change. Double click and fill in the boxes.

To use:

    strFile = App.Path & "\test.udl"   
    Set con = New ADODB.Connection
    con.Open "File Name=" & strFile

(Obviously assumes .udl file is in same directory as the application - App.Path is VB speak for this).
Justin Send private email
Thursday, February 24, 2005
Actually, UDL files were what I was thinking of, not DSN's.  I created one of each to jar my memory, and it was UDL's that I used to use.

I don't see UDL's very often any more, so I assumed that there was a better way.
Cowboy coder
Thursday, February 24, 2005

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz