• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3425
  • 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
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

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