• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3411
  • Last Modified:

SQL Server instance port connection string

What's the format that server, instance, and port have to appear in a sql server connection string?

Thanks
0
gromul
Asked:
gromul
  • 4
  • 2
1 Solution
 
imitchieCommented:
Provider=SQLOLEDB.1;Password=xxxx;Persist Security Info=True;User ID=xxxxx;Initial Catalog=mydbname;Data Source=servername\instance
0
 
imitchieCommented:
If you want to connect on a non-standard port, you'll have to do that by creating a SQL alias in SQL Server Client Network Utility (Start->Run->CliConfg.exe),
and setting the port number there
0
 
gromulAuthor Commented:
Could I do something like this?

DataSource=servername\instance,port
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
imitchieCommented:
what application or IDE are you using?
0
 
gromulAuthor Commented:
I want to set up a connection string from C# code.
0
 
imitchieCommented:
then yup, DataSource=servername\instance,port is right

Provider=SQLOLEDB.1;Password=xxxx;Persist Security Info=True;User ID=xxxxx;Initial Catalog=mydbname;Data Source=servername\instance,port;
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
note: unless your sql server has been changed to use the non-default port, you can leave the port information out of the connection string.
only in an environment where the sql server port has been changed for security it must be specified...
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now