Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Finding connection strings in legacy applications

  • 22-02-2012 7:43pm
    #1
    Registered Users, Registered Users 2 Posts: 3,429 ✭✭✭


    I have a scenario as follows

    A mix of legacy applications spread over asp, asp.net (vb and c#), Access adp and VBA. They all refer back to SQL Server 2000. That SQL Server is now being moved to a new physical server so all the connections string need to be updated.

    The code in the applications above is not great. The mix goes from 2 tier to n tier. Some of the asp.net stuff has connection strings in several web.config files. Some of the VB and C# code uses connection strings all over the place.

    Now I know, it's terrible. But that's not the point. It's all for the chop at some stage but for now, we have to do the SQL migration and hopefully get it right first time.

    Is there a way to quickly search entire projects for connection strings? or any string for that matter? If I have to sit down and go through every form / webform, I'm in trouble.

    Any advice greatly appreciated.


Comments

  • Closed Accounts Posts: 7,145 ✭✭✭DonkeyStyle \o/


    I'm not that knowledgeable when it comes to what tools are out there, so this may not be ideal, but to get the ball rolling...
    Notepad++ has a "Find in files" feature. You specify a folder, specify what ever file extensions you want, then search for a string or regular expression in all those files. It's good if you know what you're looking for and if you don't absolutely have to search hundreds of files at once.


  • Registered Users, Registered Users 2 Posts: 4,857 ✭✭✭shootermacg


    There's a win32 version of grep which will go through entire directories and return matching strings along with the files involved.

    Ah here's one, gave it a try and it'll handle recursive searches, reg ex and multiple extensions so what more could you ask for:
    http://www.wingrep.com/download.htm

    If the same sql server is involved, do a search on the server name.
    Do a search in visual studio for "server=", "connection", etc for each solution,

    Looks like with that mess, you may find it hard-coded in the source, markup as well in the various web/app.configs (I've found them in the unlikeliest of places), take a quick look for dllhost.exe.config in system32 if there are any old com servers involved, (used to be all the rage before .net 2), post .net2 should have manifest files that point to where a com server's config file is. don't forget the machine.config either.
    I've also seem these strings in the registry, but I'd say you're probably ok there unless some serious idiots were doing their thing.

    Anyway full regression testing should be mandatory for any major changes.


Advertisement