IP connections

  • Hi all,

    I new here so I will take a second to say hi and introduce myself. My name is Scott and I will soon be graduating from my object oriented programming course.

    My question to you is, how do I connect to an SQL server on another machine?

    I have SQL express 2005 running on my development laptop and my personal laptop at home. While at home I am trying to connect to the SQL server on my personal computer from my development computer without any luck. My goal is to add the connection string to my cellphone app I am developing so it can connect to the database. I have started by enabling the tcp/ip option in server manager. I then have been trying to use the server name to get the remote connection established, (SCOTT-LCEDYAZ0I\SQLEXPRESS) with the sa name and password. I have not yet been able to get them to connect. I have also tried the ip address with port 1433 from my application without any success. I would be great full if anyone would be able to walk me through the steps I need in order to get this to work. Some additonal information I am not sure if it is relevant or not, my development machine has an XP os and is running vmware. I am trying to connect from server2008 running in vmware to my XP home machine. Would being on separate domains cause a problem when connection through IP?

    Thank you for your time,

    Scott

  • SQL 2005 and 2008 Express do not allow external conenctions by default, however, that is not a problem, they deploy this way for security reasons. In SQL 2005 you can use the Surface Area Configuration manager to enable remote connections. What that really does is enable the TCP/IP protocol which is disabled right now.

    CEWII

  • Thank you Elliott for your quick reply, I followed your instructions here, I had already turned on the tcp/ip protocols. Still no luck as of yet.

  • Is there a firewall on the machine with Express, perhaps windows firewall?

    If so then you might need to add and exception for sql.. I can't tell you what port because express uses dynamic ports. But you should be able to either check a box allowing sqlsrvr.exe (or something close) as an exception or if you can figure out what IP port it is using you can allow that too. Also is SQL Browser running and is it also allowed to be accessed through the firewall..

    CEWII

  • On my personal machine that I am trying to connect to I had taken the shotgun approach and just shut off the firewall to prevent any problems. On my development machine (where the connection is starting from) the fire wall is on. I will look at allowing it through the firewall. On a side note, when I am at the login screen on the sql server I select browse to find the server running my database on my personal computer but I cannot even see any other servers running on my network. I have also turned on browsing on both machines, I will take a look at the firewall settings for it on my development machine.

    if it helps, the connection string I was using from my program is:

    SqlConnection("Data Source=174.0.11.10,1433;Network Library=DBMSSOCN;Initial Catalog=OnlineBooks;User ID=sa;Password=mypassword;");

    and the error I get from it is:

    A network-related or instance-specific error occurred while establishing a connection to SQL server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL server is configured to allow remote connections. (Provider: tcp provider, error: 0-A connection attempt failed because the connection party did not properly respond after a period of time, or established connection failed because connection host has failed to respond.)

    although it seems what ever I put under the sqlconnection I get the same vague message.

  • I think I *might* see the problem.. default instances of SQL use port 1433, express usually doesn't without you doing something intentionally, this part of the connection "174.0.11.10,1433" is where I think the problem is, you might take the 1433 off, it allows it to try and figure it out, when the port is specified it expects the server to be listening on that port at that address as opposed to using the underlying infrastructure to figure it out..

    CEWII

  • Thank you very much, I got it to work within my local network. You were right on. I set the port to 1433 and now its good. Now that I know it will work in my network, I am trying to get it to work over the internet. I have forwarded the ports (I think) on the router and am using the networks ip address. Is there some additional settings on sql to have to allow this? Or is it all on my router. If it makes a difference I have a belkin wireless n router brand new. My school project presentation is on Friday and I am still messing around with getting this to work. Kind of a pain these things are not more intuitive.

    Thanks again for your help here,

    Scott

  • Glad to hear it, sometime it just takes another set of eyes..

    CEWII

Viewing 8 posts - 1 through 7 (of 7 total)

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