SQL Launcher application

By sjohnson ·
Currently our company has 5 different SQL databases. We are looking for a way to allow the user to select the database they want to connect to and then after selecting it changes the ODBC settings and then opens the application.
Is there currently any software out there that can do this or does anyone have any suggestions.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

Are you saying you have

by Tony Hopkinson In reply to SQL Launcher application

one application, that uses one DSN, and that's mapped to different DBs ?

Well you could try upgrading to something written in the twentieth century, or perhaps shoot your developers, if it's in house.

It could be done, it might even have been done. It's a potential security and a definite maintenance disaster of the first water though.

Here's ms's answer

Personally I'd rather flatten my testicles with a hammer.

Collapse -

I am sorry I didn't explain myself very well

by sjohnson In reply to Are you saying you have

Each DB has a different DSN and a different DB name and not all DB's are on the same SQL server. We have 3 SQL servers: 2 of the DB's are on 1 server and have different DB names.
The other DB's are on their own SQL server.

SQL1 Server --> DB name = DBR
SQL2 Server --> DB name = DBR
SQL3 Server --> DB name = DBR-Office1 and DBR-Office2

Collapse -

Nor did I

by Tony Hopkinson In reply to I am sorry I didn't expla ...

How does the application link up to the correct database then?

Normally that would be hardcoded in the application code. A parameter in the registry, ini file etc, or off the command line

Or there would be some mechanism within the application to choose the datasource to use.

Lets say it's hardcoded
e.g The application expects a DSN called MyAppServer to be pointing at one of the above.

Either thru a script or by writing little launcher application.

You'd wipe out MyAppServer, and then copy an existing DSN pointing at the chosen server and rename it as MyAppServer, and then run the application.

If you make the target DSN a parameter of the launching doodad, Then all you need is three shortcuts each one with a command line parameter of the name of the DSN you want to use.

If it's a registry or ini file then you just write a script to edit that.

Note if you are talking System DSNs, or ini files in privileged areas of the drive, or regsitry keys in protected areas, you could have access problems security wise. Some will be guaranteed UAC nags in Vista, if you are or want to use it.

DSNs are really really old tech, if you can get access to the source for your apps, I'd get rid of them and fix this issue as well.

Collapse -

Do this via dos command

by Slayer_ In reply to SQL Launcher application

%windir%\system32\odbcconf configsysdsn "Driver Name" "DSN=DSN Name|SERVER=ServerName|DATABASE=Database name"

This will both create and change them, the user cannot be set this way, it can be set through the registry. However, once the user and password is set once, it will "stick" for each change.

Related Discussions

Related Forums