Vous êtes sur la page 1sur 4

How to connect to SQL Server from another computer?

- Stack Overflow

Page 1 of 4

sign up

log in

tour

help

careers 2.0

Overflow

Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no
registration required.

Take the 2-minute tour

How to connect to SQL Server from another computer?

I want to connect from home using SQL Server 2005 to another PC.
I had a look on the msd...but before connecting it says I should connect to another computer using the
computer management and it didn't work out....I can only connect to computers from my workgroup?
Thanks, Luisa
sql

sql-server-2005

sql-server-2008

sql-server-ce

edited Mar 21 '10 at 10:04

asked Mar 21 '10 at 9:56

marc_s
289k 29 457 658

Luisa
125 1 1 12

This question is not clear - can you explain what exactly are you trying to do ? Dani Mar 21 '10 at 10:08
This is for server fault no? super9 May 7 '10 at 15:21

add comment

4 Answers
If you want to connect to SQL server remotly you need to use a software - like Sql Server Management
studio.
The computers doesn't need to be on the same network - but they must be able to connect each other using
a communication protocol like tcp/ip, and the server must be set up to support incoming connection of the
type you choose.
if you want to connect to another computer (to browse files ?) you use other tools, and not sql server (you
can map a drive and access it through there ect...)
To Enable SQL connection using tcp/ip read this article:
For Sql Express: express For Sql 2008: 2008
Make sure you enable access through the machine firewall as well.
You might need to install either SSMS or Toad on the machine your using to connect to the server. both you
can download from their's company web site.
edited Mar 21 '10 at 13:15

answered Mar 21 '10 at 10:10


Dani
7,466 3 20 54

Yes I want to connect remotly...I have access tot the computer using run->mstsc. I set on sql configuration
manager protocol tcp/ip as enabled but how I do "the server must be set up to support incoming connection of
the type you choose." Thanks Luisa Mar 21 '10 at 10:31

mstsc = Microsoft Terminal Services - that has nothing to do with SQL Server...... marc_s Mar 21 '10 at
11:19

you are mixing 2 issues: when you use mstsc - you are actually on the remote machine. you don't need tcp/ip
cause you can admin it locally. I'll edit the answer with info how to enable remote access to sql server Dani
Mar 21 '10 at 13:10

http://stackoverflow.com/questions/2486610/how-to-connect-to-sql-server-from-another-computer

1/22/2014

How to connect to SQL Server from another computer? - Stack Overflow

Page 2 of 4

Check also that SQL Server Browser service is running. That fixed my problem too. Fabian Fernandez Nov
26 '12 at 18:15
add comment

Disclamer
This is just some additional information that might help anyone. I want to make it abundantly clear that what I
am describing here is possibly:



A. not 100% correct and


B. not safe in terms of network security.

I am not a DBA, but every time I find myself setting up a SQL Server (Express or Full) for testing or what not
I run into the connectivity issue. The solution I am describing is more for the person who is just trying to get
their job done - consult someone who is knowledgeable in this field when setting up a production server.
For SQL Server 2008 R2 this is what I end up doing:
1. Make sure everything is squared away like in this tutorial which is the same tutorial posted above as a
solution by "Dani" as the selected answer to this question.
2. Check and/or set, your firewall settings for the computer that is hosting the SQL Server. If you are using
a Windows Server 2008 R2 then use the Server Manager, go to Configuration and then look
at "Windows Firewall with Advanced Security". If you are using Windows 7 then go to Control Panel
and search for "Firewall" click on "Allow a program through Windows Firewall".
 Create an inbound rule for port TCP 1433 - allow the connection
 Create an outbound rule for port TCP 1433 - allow the connection
3. When you are finished with the firewall settings you are going to want to check one more thing. Open
up the "SQL Server Configuration Manager" locate: SQL Server Network Configuration - Protocols for
SQLEXPRESS (or equivalent) - TCP/IP
 Double click on TCP/IP
 Click on the IP Addresses tab
 Under IP1 set the TCP Port to 1433 if it hasn't been already
 Under IP All set the TCP Port to 1433 if it hasn't been already
4. Restart SQL Server and SQL Browser (do both just to be on the safe side)
Usually after I do what I mentioned above I don't have a problem anymore. Here is a screenshot of what to
look for - for that last step:

http://stackoverflow.com/questions/2486610/how-to-connect-to-sql-server-from-another-computer

1/22/2014

How to connect to SQL Server from another computer? - Stack Overflow

Page 3 of 4

Again, if someone with more information about this topic sees a red flag please correct me.
Hope this helps.
edited Jul 20 '11 at 18:39

answered Jul 20 '11 at 16:22


dyslexicanaboko
1,776 2 10 19

add comment

I'll edit my previous answer based on further info supplied. You can clearely ping the remote computer as
you can use terminal services.
I've a feeling that port 1433 is being blocked by a firewall, hence your trouble. See TCP Ports Needed for
Communication to SQL Server Through a Firewall by Microsoft.
Try using this application to ping your servers ip address and port 1433.
tcping your.server.ip.address 1433

And see if you get a "Port is open" response from tcping.


Ok, next to try is to check SQL Server. RDP onto the SQL Server computer. Start SSMS. Connect to the
database. In object explorer (usually docked on the left) right click on the server and click properties.
alt text

Goto the Connections settings and make sure "Allow remote connections to this server" is ticket.
alt text

edited May 20 '10 at 20:49

answered May 18 '10 at 8:25


Simon Hughes
2,171 1 9 22

add comment

all of above answers would help you but you have to add three ports in the firewall of PC on which SQL
Server is installed.
1. Add new TCP Local port in Windows firewall at port no. 1434

http://stackoverflow.com/questions/2486610/how-to-connect-to-sql-server-from-another-computer

1/22/2014

How to connect to SQL Server from another computer? - Stack Overflow

Page 4 of 4

2. Add new program for SQL Server and select sql server.exe Path: C:\ProgramFiles\Microsoft SQL
Server\MSSQL10.MSSQLSERVER\MSSQL\Binn\sqlservr.exe
3. Add new program for SQL Browser and select sqlbrowser.exe Path: C:\ProgramFiles\Microsoft SQL
Server\90\Shared\sqlbrowser.exe
answered Jan 2 '12 at 5:03
Mujassir Nasir
720 7 31
add comment

Not the answer you're looking for? Browse other questions tagged sql sql-server-2005
sql-server-2008

sql-server-ce or ask your own question.

http://stackoverflow.com/questions/2486610/how-to-connect-to-sql-server-from-another-computer

1/22/2014

Vous aimerez peut-être aussi