Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

SQL Server instance port connection string

Posted on 2007-11-27
7
Medium Priority
?
3,404 Views
Last Modified: 2008-02-01
What's the format that server, instance, and port have to appear in a sql server connection string?

Thanks
0
Comment
Question by:gromul
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 25

Expert Comment

by:imitchie
ID: 20362386
Provider=SQLOLEDB.1;Password=xxxx;Persist Security Info=True;User ID=xxxxx;Initial Catalog=mydbname;Data Source=servername\instance
0
 
LVL 25

Expert Comment

by:imitchie
ID: 20362393
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
 

Author Comment

by:gromul
ID: 20362427
Could I do something like this?

DataSource=servername\instance,port
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 25

Expert Comment

by:imitchie
ID: 20362555
what application or IDE are you using?
0
 

Author Comment

by:gromul
ID: 20362782
I want to set up a connection string from C# code.
0
 
LVL 25

Accepted Solution

by:
imitchie earned 2000 total points
ID: 20362803
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
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 20363503
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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question