473,748 Members | 2,426 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Logging Into Linked Server

After creating a linked server to a remote server, I needed to log in using
sp_addlinkedsrv login to get my stored procedure to work. However, I noticed
that after stopping SQL Server and the DTC and then restarting both, that my
stored procedure worked without having to execute sp_addlinkedsrv login.

Is the log-in information stored in the machine, such that if SQL Server is
stopped or the server is rebooted, on does not have to execute
sp_addlinkedsrv login again? Or is there a point at which one would have to
re-log-in to a linked server?

Thanks.

May 15 '06 #1
6 4747
Neil (no****@nospam. net) writes:
After creating a linked server to a remote server, I needed to log in
using sp_addlinkedsrv login to get my stored procedure to work. However,
I noticed that after stopping SQL Server and the DTC and then restarting
both, that my stored procedure worked without having to execute
sp_addlinkedsrv login.

Is the log-in information stored in the machine, such that if SQL Server
is stopped or the server is rebooted, on does not have to execute
sp_addlinkedsrv login again? Or is there a point at which one would have
to re-log-in to a linked server?


You appears to have missunderstood the purpose of sp_addlinkedsrv login. The
procedure does not login into the remote server. I have not checked, but I
would assume that you can run sp_addlinkedsrv login without the linked server
being available.

What sp_addlinkedsrv login does, as you already have discovered, is to store
information, so that when you issue a query to the linked server, SQL Server
can log in to that data source. So this is a configuration procedure that
you run once, or possible when you need to give a new user access to the
linked server.

--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
May 15 '06 #2
Speaking of linking to a server, is it possible to assign a linked server an
alias at the time it is linked? The reason is that our linked server is a
web server, and it's possible that sometime in the not-too-distant future
its address will change, and, at that point, I'd have to go into the stored
procedures and manually change the server name. Can I assign an alias so
that if a new server has to be linked it can have the same alias?

Thanks.
"Erland Sommarskog" <es****@sommars kog.se> wrote in message
news:Xn******** **************@ 127.0.0.1...
Neil (no****@nospam. net) writes:
After creating a linked server to a remote server, I needed to log in
using sp_addlinkedsrv login to get my stored procedure to work. However,
I noticed that after stopping SQL Server and the DTC and then restarting
both, that my stored procedure worked without having to execute
sp_addlinkedsrv login.

Is the log-in information stored in the machine, such that if SQL Server
is stopped or the server is rebooted, on does not have to execute
sp_addlinkedsrv login again? Or is there a point at which one would have
to re-log-in to a linked server?


You appears to have missunderstood the purpose of sp_addlinkedsrv login.
The
procedure does not login into the remote server. I have not checked, but I
would assume that you can run sp_addlinkedsrv login without the linked
server
being available.

What sp_addlinkedsrv login does, as you already have discovered, is to
store
information, so that when you issue a query to the linked server, SQL
Server
can log in to that data source. So this is a configuration procedure that
you run once, or possible when you need to give a new user access to the
linked server.

--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx

May 15 '06 #3
Neil (no****@nospam. net) writes:
Speaking of linking to a server, is it possible to assign a linked
server an alias at the time it is linked? The reason is that our linked
server is a web server, and it's possible that sometime in the
not-too-distant future its address will change, and, at that point, I'd
have to go into the stored procedures and manually change the server
name. Can I assign an alias so that if a new server has to be linked it
can have the same alias?


If you are on SQL 2005, you can always use synonyms.

If you are on some earlier version of SQL Server you can use
sp_addlinkedser ver. You see, what you define with sp_addlinkedser ver is
really an alias.

In its simplest form, you just say:

sp_addlinksedse rver 'THATSERVER'

and THATSERVER will refer to a server with that name. However, you
can also say:

sp_addlinkedser ver 'MYSERVERNAME', '', 'SQLOLEDB', 'THATSERVER'

so that you can use MYSERVERNAME as a reference to THATSERVER. Thus,
when you web server changes, you just drop the server, and recreate
it with the new information.

Note: the syntax above may not work exactly like that. I usually have
problem with more advanced usage of sp_addlinksedse rver myself. But
it usually sorts out when I've been looking at the topic for
sp_addlinksedse rver in Books Online for a while.
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
May 15 '06 #4
> In its simplest form, you just say:

sp_addlinksedse rver 'THATSERVER'

and THATSERVER will refer to a server with that name. However, you
can also say:

sp_addlinkedser ver 'MYSERVERNAME', '', 'SQLOLEDB', 'THATSERVER'


So, basically:

sp_addlinkedser ver @server = 'MYSERVERNAME', @provider = 'SQLOLEDB',
@datasrc = 'THATSERVER'

I'll give that a shot. Thanks.

Neil
May 15 '06 #5
Neil (no****@nospam. net) writes:
So, basically:

sp_addlinkedser ver @server = 'MYSERVERNAME', @provider = 'SQLOLEDB',
@datasrc = 'THATSERVER'

I'll give that a shot. Thanks.


Yeah, but as I recall the second parameter, @srvproduct, may not be NULL.
But you'll find out. :-)

--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
May 16 '06 #6
Yup, you were right. Used '' and it worked fine. Thanks!

"Erland Sommarskog" <es****@sommars kog.se> wrote in message
news:Xn******** *************@1 27.0.0.1...
Neil (no****@nospam. net) writes:
So, basically:

sp_addlinkedser ver @server = 'MYSERVERNAME', @provider = 'SQLOLEDB',
@datasrc = 'THATSERVER'

I'll give that a shot. Thanks.


Yeah, but as I recall the second parameter, @srvproduct, may not be NULL.
But you'll find out. :-)

--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx

May 16 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1841
by: Christian.Gruber | last post by:
>Description: It would be nice if general query logging could be switched on and off while the MySQL server is running, and not only at startup time. While debugging an application that uses foreign database access libraries, this would be very helpful. One could switch on logging, perform an activity, switch off logging, and look what has happened. Otherwise, the server has to be restarted to change logging, which is a bit annoying......
0
1887
by: Moritz Steiner | last post by:
Ok, but this only works for the current session, if I close and restart = the client the settings are reset... -----Urspr=FCngliche Nachricht----- Von: Victoria Reznichenko =20 Gesendet: Mittwoch, 16. Juli 2003 11:19 An: mysql@lists.mysql.com Betreff: Re: switch query logging while the server is running
6
6782
by: Andreas Lauffer | last post by:
I changed from Access97 to AccessXP and I have immense performance problems. Details: - Access XP MDB with Jet 4.0 ( no ADP-Project ) - Linked Tables to SQL-Server 2000 over ODBC I used the SQL Profile to watch the T-SQL-Command which Access ( who creates the commands?) creates and noticed:
23
2221
by: Rotem | last post by:
Hi, while working on something in my current project I have made several improvements to the logging package in Python, two of them are worth mentioning: 1. addition of a logging record field %(function)s, which results in the name of the entity which logged the record. My version even deduces the class name in the case which the logger is a bound method, and assuming the name of the "self" variable is indeed "self".
16
2174
by: Einar Høst | last post by:
Hi, I'm getting into the Trace-functionality in .NET, using it to provide some much-needed logging across dlls in the project we're working on. However, being a newbie, I'm wondering if some more experienced loggers can provide me with some ideas as to how to log in a simple yet flexible manner. For instance, I'd like the code to be as uncluttered as possible by Trace statements. As an example of basic logging functionality, I've come...
3
5402
by: nicholas.petrella | last post by:
I am currently trying to use the python logging system as a core enterprise level logging solution for our development and production environments. The rotating file handler seems to be what I am looking for as I want the ability to have control over the number and size of log files that are written out for each of our tools. I have noticed a few problems with this handler and wanted to post here to get your impressions and possibly...
9
1955
by: Rasika WIJAYARATNE | last post by:
Hi guys, Please check this out: http://rkwcoding.blogspot.com/2007/07/error-logging.html
6
7585
by: Larry Bates | last post by:
Every time I look at the logging module (up until now) I've given up and continue to use my home-grown logger that I've been using for years. I'm not giving up this time ;-) I find that I REALLY need to be able to monitor LOTS of running programs/processes and thought it would be nice to have them use SocketHandler logging and then I would write TCPServer to accept the log messages for real-time monitoring. I Googled (is that now a...
0
8984
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8237
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6793
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4593
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2775
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2206
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.