Multiple Connection Strings to same Data Source

  • I have a web site that accesses our SQL 2000. server. Both servers have internal and external IPs. Our programmer has coded mulitple Case connection strings. He has coded cases for URL,External IP, Internal IP, NETBIOS names (upper and lower case), etc...There are about 20 cases, this seems inefficent to me.Why not code for only internal connections??  Does SQL choose the first conneciton string or does it open them all up?? What would be the best way to do this and should I code one connection string multiple times to "speed" things up?? 

    Select Case sServerName

     Case "URL"  : gsConnect="Provider = SQLOLEDB.1;Persist Security Info=True;User ID=LOGIN;Password=Pass;Initial Catalog=DBata Source=External IP;Connect Timeout=15"

     

    Case "NETBIOS NAME"  : gsConnect="Provider = SQLOLEDB.1;Persist Security Info=True;User ID=LOGIN;Password=Pass;Initial Catalog=DB;Data Source=External IP;Connect Timeout=15"

     Case "EXTERNAL IP"  : gsConnect="Provider = SQLOLEDB.1;Persist Security Info=True;User ID=LOGIN;Password=Pass;Initial Catalog=DB;Data Source=NETBIOS NAME;COnnect Timeout=15"

     

    Any responses are appreciated, Thank you.

  • Are the credentials the same in all cases?

    Reading what you've written, are both the web server and the SQL Server dual homed? Sounds like it when you say both have an internal and external IP. In that case there may have to be two connection strings, depending on your firewall setup, etc. External may only be able to talk to external and internal to internal or something along those lines. More than that doesn't seem to make a whole lot of sense.

    And from the snippet of code you gave, only one connection string is going to "win out" in the end. It'll be that one the application uses to connect to SQL Server. SQL doesn't choose in this case, the app does.

    K. Brian Kelley
    @kbriankelley

  • All the login credentials are the same.

      The web server/e-mail server has dual nics, NIC A- 192.168.2.42(internal) connected to the switch for communcation with the rest of the network. NIC B 192.168.1.43 directly into Firewall that NATS out the external IP to this one just for web/e-mail services. The SQL server  has one NIC 192.168.2.44 with NAT setup on it's firewall for it's external IP to Internal. The application is written for loging on to our website and getting customer info on our SQL server etc. Those connection strings are in the Config.asp page of our website, there are about 20 different strings under the  "Select Case sServerName"  How does SQL determine the "sServerName" of the computer connecting to it? Is it IP,MAC,NETBIOS,etc or what has been written in the string.  If both servers are on the same internal subnet wouldn't it be faster to have one connection string that provides internal IP's or NETBIOS names versus external IP's that have to go out around and back in?  Every question I ask myself brings out 10 more questions. Thanks for the reply.

     

     

     

  • You're going to have to look in the code to determine sServerName. This is in the application, not SQL Server.

    Serious question here... is there a reason the SQL Server has a NIC in the DMZ? Is there a reason your web server has a NIC in both? If I compromise the web server from externally, the internal NIC gives me access into your internal network, bypassing the firewall.

    K. Brian Kelley
    @kbriankelley

  • Thanks Brian,

    I assumed that the programmer just coded multiple case strings to cover all name variations of one server, he has the IPs,NETBIOS Name,URL all from that web/e-mail server, it's got me confused, it works but I want to know what is the best way for it to work. I am having some issues with the webserver locking up when accessing the SQL server. This prompted me to write this post. I think it might be the web/e-mail server causing this problem more so then the SQL server, didn't have these problems till I redid the web server.  

    To answer you question about the network configuration and the DMZ:  I didn't setup the network but I now maintain the whole thing and try to correct the many problems it has.  The SQL server is not setup on the DMZ, it is connected to the switch which is connected to Firewall A, which has the SQL server's external IP NAT'd to internal IP (LAN so users can connect too).

       The web/e-mail server has the two nics. NIC A connected to switch (same as SQL server) connected to FIREWALL A.   NIC B is connected to Firewall B DMZ which NATS web/e-mail external IP to internal IP (different subnet). I want to take full advantage of both NICS but aside from this configuration I really don't know how (I am not familar with NIC teaming etc.) NIC A is for local traffic to/from users for e-mail whereas NIC B provides web services. This is the orginal configuration (almost, the ppl before me didn't even have NIC B on a firewall it was connected directly into the internet! Guess who had to clean up the hacked server???)

    The SQL server also has a custom written VB application for loading and posting info into our SQL database that all the users use, so it must be on the LAN otherwise I would leave it on the DMZ with just an ext IP.  I am sure there is a better way but I am pretty new in this field and changing things around is usually not a quick task.

    I apprecitate your time,  I could waste it all day!!!

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply