Home All Groups Group Topic Archive Search About

Setting up the SQL Server alias programatically

Author
12 Sep 2006 4:22 PM
Chris Dunaway
In our corporate environment, the data services group, for some reason,
does not run SQL Server using it's default ports, they always change.
For my application, I have to install the SQL client tools on the
machine where the app will be run and then set up an alias to that
port.

Can this be done programatically or with a change to the connection
string without having to install the SQL client tools?  Is there a
registry setting to be added?

We are using SQL authentication.

Thanks

Chris

Author
12 Sep 2006 4:30 PM
Chris Dunaway
Chris Dunaway wrote:
> In our corporate environment, the data services group, for some reason,
> does not run SQL Server using it's default ports, they always change.
> For my application, I have to install the SQL client tools on the
> machine where the app will be run and then set up an alias to that
> port.
>
> Can this be done programatically or with a change to the connection
> string without having to install the SQL client tools?  Is there a
> registry setting to be added?
>

Isn't that always the way?  As soon as you post the question, you find
the answer.  For the benefit of others, here is the answer.

Just add an entry to the following registry key:

HKLM\SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo

While this seems to work, I would much rather have a programatic
solution that did not involve directly editing the registry.

Thanks again
Are all your drivers up to date? click for free checkup

Author
12 Sep 2006 5:08 PM
David Browne
<DIV>&quot;Chris Dunaway&quot; &lt;dunaw***@gmail.com&gt; wrote in message
news:1158078153.082920.14790@e63g2000cwd.googlegroups.com...</DIV>> In our
corporate environment, the data services group, for some reason,
> does not run SQL Server using it's default ports, they always change.
> For my application, I have to install the SQL client tools on the
> machine where the app will be run and then set up an alias to that
> port.
>
> Can this be done programatically or with a change to the connection
> string without having to install the SQL client tools?  Is there a
> registry setting to be added?
>
> We are using SQL authentication.
>

1) If the SQL Server runs the SQL Browser Service, your clients should be
able to connect without knowing the port.

2) You should be able to configure the application to specify the port,
instead of having to use a client alias.

David
Author
12 Sep 2006 6:28 PM
Chris Dunaway
David Browne wrote:

> 2) You should be able to configure the application to specify the port,
> instead of having to use a client alias.

Thanks David,

After a little more research, I was able to use this connection string
without adding any entries to the registry:

server=server,12345;Network Library=DBMSSOCN;database=dbname;User
Id=user;Password=password;

BTW:  I'm using C# 2.0,  Enterprise Library January 2006

Bookmark and Share