How to Connect to SQL Server from Another Computer

How to connect to SQL Server from another computer?

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.

Connect to SQL Server from another computer - SQL network-instance related issue (with error 258)

This tuto solved the problem for me:
Allow SQL Server through Windows Firewall (
https://www.youtube.com/watch?v=3jVTUll4PXs)
I had to add the paths of the sql server and sql server browser services to the allowed apps by the firewall.

Connecting to SQL server from another computer

There are few things you should check:

  1. Remove "Trusted_Connection=True;" in your connection string

  2. Turn off the firewall on both machines for testing. If it works, you can enable the both of them and then configure the access rights for specific application

  3. Enable SQL Authentication on SQL Server instance: http://kbase.gfi.com/showarticle.asp?id=KBID002804

  4. Simple way to test it works or not without running your c# code: you can install the SQL Management Studio on the code-machine and try to connect the SQL Server instance.

Hope it helps.

C# SQL database access from another PC

The issue is resolved! All the steps I followed are perfect. You can say that if you want to connect to the client's PC using an ethernet connection. Follow the steps in question step by step. Focus on the connection string. Use the connection string of number 3. Let me write it again for clarification.

Data Source=tcp:DESKTOP-0DCQGE3,49172;Initial Catalog=dbposrpc;User ID=sa;Password=12345678;

Here SQLEXPRESS is the SQL Server instance name, DESKTOP-0DCQGE3 is the server PC name, 49172 is the TCP port that I selected as static.

How I resolved the issue?

I just cleared the solution, restarted the project again and everything worked fine for me.

How to connect SQL Server Express database from another Pc?

On PC1, you must ensure that the SQL Server Express instance allows remote connections (see this other SO question and its answers for details on how to do this.

Also, you need to create logins on the server instance, and users in your database(s). If all those three PC's are members in a Windows network, you can probably create logins based on Windows user accounts - otherwise, you have to use SQL Server specific logins.

Then, on PC2 and PC3, you can use something like this:

server=PC1;database=YourDatabase;User ID=SomeUserID;Password=SomePassword

See ConnectionStirngs.com for a great many more examples and explanations

Update:

If I understand correctly, this is what you want to do:

  • have PC1 be the "server" in your setup - if so, then install SQL Server Express with tools (including the Management Studio) on this server. Make a note of what instance name you use when installing SQL Server Express! The default is SQLEXPRESS, but you can choose anything you like

  • make sure the SQL Server Express instance allows remote connections

  • create the necessary logins on that server instance

  • create your database on that server (where it belongs - after all, SQL Server is a server-based solution)

  • create the necessary users in that database for your logins

With this setup, you should easily be able to connect from PC2 and PC3 to your SQL Server database on PC1



Related Topics



Leave a reply



Submit