 |
|
 |
|
Next: server management studio insert row to table Erro..
|
| Author |
Message |
External

Since: Apr 18, 2007 Posts: 14
|
(Msg. 1) Posted: Sun Jan 21, 2007 8:05 pm
Post subject: Self Linked Server Archived from groups: microsoft>public>sqlserver>programming (more info?)
|
|
|
Hi,
I am setting up a linked server on my local SQL server 2000 development
machine.
The server is linking to itself and I am setting this up soley for learning
purposes.
I first used the command
Exec sp_addlinkedserver @server='link' , @srvproduct='SQLServer OLEDB
Provider' , @provider='SQLOLEDB' , @datasrc='Developement'
which worked (ie added the linked server - I verified this by running EXEC
sp_linkedservers), but when I ran the following query
select CustomerID, CompanyName from link.northwind.dbo.Customers
I was given the error message
SQL Server does not exist or access denied.
This seemed strange as my security credentials should be the same on the
linked server and the local server as they are basically both the same
machine.
I am using intergrated security.
Incidently the method above i got from my wrox press sql server 2000 book
and this eems to work fine in the book.
secondly I used the following command to add a linked server back to itself
EXEC sp_addlinkedserver
@server = 'self',
@srvproduct = '',
@provider = 'MSDASQL',
@datasrc = NULL,
@location = NULL,
@provstr = 'DRIVER={SQL Server};Server=(local); Initial
Catalog=master;Integrated Security=SSPI;'
I then ran my query
select CustomerID, CompanyName from link.northwind.dbo.Customers
which returned the results I was expecting.
I would like to ask what I did wrong in the first example.
as the user accounts are the same on the linked server and local machine
(they are basically both the same instance) I am a little stumped.
thanks in advance
cheers
martin. >> Stay informed about: Self Linked Server |
|
| Back to top |
|
 |  |
External

Since: Feb 03, 2008 Posts: 219
|
(Msg. 2) Posted: Sun Jan 21, 2007 8:05 pm
Post subject: Re: Self Linked Server [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Hi, Martin
Is your computer name "Development" ? If no, replace the @datasrc with
your computer name.
If yes, check the current setting for the logins mapping, using
Management Studio or Enterprise Manager, in the Security page of the
linked server properties. The third option should be checked "Be made
using the login's current security context".
Razvan >> Stay informed about: Self Linked Server |
|
| Back to top |
|
 |  |
External

Since: Aug 24, 2003 Posts: 1744
|
(Msg. 3) Posted: Sun Jan 21, 2007 8:05 pm
Post subject: Re: Self Linked Server [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Martin
I did just some testing and it worked fine
EXEC sp_addlinkedserver @server='server1', @srvproduct='',
@provider='SQLOLEDB', @datasrc='myserver'
select * from server1.demo.dbo.t1
In your case you used two different providers to create a linked server
(SQLOLEDB,MSDASQL)
Make sure that your server name is 'Developement'. Try connect as (local)
EXEC sp_addlinkedserver @server='link', @srvproduct='',
@provider='SQLOLEDB', @datasrc='local'
"Martin" wrote in message
> Hi,
>
> I am setting up a linked server on my local SQL server 2000 development
> machine.
> The server is linking to itself and I am setting this up soley for
> learning
> purposes.
>
> I first used the command
>
> Exec sp_addlinkedserver @server='link' , @srvproduct='SQLServer OLEDB
> Provider' , @provider='SQLOLEDB' , @datasrc='Developement'
>
> which worked (ie added the linked server - I verified this by running EXEC
> sp_linkedservers), but when I ran the following query
>
> select CustomerID, CompanyName from link.northwind.dbo.Customers
>
> I was given the error message
>
> SQL Server does not exist or access denied.
>
> This seemed strange as my security credentials should be the same on the
> linked server and the local server as they are basically both the same
> machine.
> I am using intergrated security.
> Incidently the method above i got from my wrox press sql server 2000 book
> and this eems to work fine in the book.
>
> secondly I used the following command to add a linked server back to
> itself
>
> EXEC sp_addlinkedserver
> @server = 'self',
> @srvproduct = '',
> @provider = 'MSDASQL',
> @datasrc = NULL,
> @location = NULL,
> @provstr = 'DRIVER={SQL Server};Server=(local); Initial
> Catalog=master;Integrated Security=SSPI;'
>
> I then ran my query
>
> select CustomerID, CompanyName from link.northwind.dbo.Customers
>
> which returned the results I was expecting.
>
> I would like to ask what I did wrong in the first example.
> as the user accounts are the same on the linked server and local machine
> (they are basically both the same instance) I am a little stumped.
>
> thanks in advance
>
> cheers
>
> martin.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> >> Stay informed about: Self Linked Server |
|
| Back to top |
|
 |  |
External

Since: Feb 03, 2008 Posts: 219
|
(Msg. 4) Posted: Sun Jan 21, 2007 8:05 pm
Post subject: Re: Self Linked Server [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Hi, Martin
The following works for me, on both SQL Server 2000 (8.00.2039) and SQL
Server 2005 (9.00.3033):
EXEC sp_addlinkedserver @server='myself', @srvproduct='',
@provider='SQLOLEDB', @datasrc='(local)'
go
select * from myself.Northwind.dbo.Customers
go
EXEC sp_dropserver 'myself'
Razvan >> Stay informed about: Self Linked Server |
|
| Back to top |
|
 |  |
External

Since: Apr 18, 2007 Posts: 14
|
(Msg. 5) Posted: Sun Jan 21, 2007 9:17 pm
Post subject: Re: Self Linked Server [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Hi Uri,
just ran the following
EXEC sp_addlinkedserver @server='link2', @srvproduct='',
@provider='SQLOLEDB', @datasrc='local'
and then the command
select CustomerID, CompanyName from link2.northwind.dbo.Customers
still get the error message
Server: Msg 17, Level 16, State 1, Line 1
SQL Server does not exist or access denied.
ran EXEC sp_linkedservers to check the linked server exists and it does.
checked the security page of the linked server properties in enterprise
manager
the third option "be made using the logon's current security context" is
selected.
any ideas???
cheers
martin.
"Uri Dimant" wrote in message
> Martin
>
> I did just some testing and it worked fine
>
> EXEC sp_addlinkedserver @server='server1', @srvproduct='',
> @provider='SQLOLEDB', @datasrc='myserver'
>
>
> select * from server1.demo.dbo.t1
>
>
> In your case you used two different providers to create a linked server
> (SQLOLEDB,MSDASQL)
>
> Make sure that your server name is 'Developement'. Try connect as (local)
> EXEC sp_addlinkedserver @server='link', @srvproduct='',
> @provider='SQLOLEDB', @datasrc='local'
>
>
>
>
>
>
>
>
> "Martin" wrote in message
>
> > Hi,
> >
> > I am setting up a linked server on my local SQL server 2000 development
> > machine.
> > The server is linking to itself and I am setting this up soley for
> > learning
> > purposes.
> >
> > I first used the command
> >
> > Exec sp_addlinkedserver @server='link' , @srvproduct='SQLServer OLEDB
> > Provider' , @provider='SQLOLEDB' , @datasrc='Developement'
> >
> > which worked (ie added the linked server - I verified this by running
EXEC
> > sp_linkedservers), but when I ran the following query
> >
> > select CustomerID, CompanyName from link.northwind.dbo.Customers
> >
> > I was given the error message
> >
> > SQL Server does not exist or access denied.
> >
> > This seemed strange as my security credentials should be the same on the
> > linked server and the local server as they are basically both the same
> > machine.
> > I am using intergrated security.
> > Incidently the method above i got from my wrox press sql server 2000
book
> > and this eems to work fine in the book.
> >
> > secondly I used the following command to add a linked server back to
> > itself
> >
> > EXEC sp_addlinkedserver
> > @server = 'self',
> > @srvproduct = '',
> > @provider = 'MSDASQL',
> > @datasrc = NULL,
> > @location = NULL,
> > @provstr = 'DRIVER={SQL Server};Server=(local); Initial
> > Catalog=master;Integrated Security=SSPI;'
> >
> > I then ran my query
> >
> > select CustomerID, CompanyName from link.northwind.dbo.Customers
> >
> > which returned the results I was expecting.
> >
> > I would like to ask what I did wrong in the first example.
> > as the user accounts are the same on the linked server and local machine
> > (they are basically both the same instance) I am a little stumped.
> >
> > thanks in advance
> >
> > cheers
> >
> > martin.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
>
> >> Stay informed about: Self Linked Server |
|
| Back to top |
|
 |  |
External

Since: Aug 24, 2003 Posts: 1744
|
(Msg. 6) Posted: Sun Jan 21, 2007 9:17 pm
Post subject: Re: Self Linked Server [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
How about
EXEC sp_addlinkedserver @server='link2', @srvproduct='',
@provider='SQLOLEDB', @datasrc='(local)'
select CustomerID, CompanyName from link2.northwind.dbo.Customers
"Martin" wrote in message
> Hi Uri,
>
>
> just ran the following
>
> EXEC sp_addlinkedserver @server='link2', @srvproduct='',
> @provider='SQLOLEDB', @datasrc='local'
>
> and then the command
>
> select CustomerID, CompanyName from link2.northwind.dbo.Customers
>
>
> still get the error message
>
> Server: Msg 17, Level 16, State 1, Line 1
> SQL Server does not exist or access denied.
>
> ran EXEC sp_linkedservers to check the linked server exists and it does.
>
> checked the security page of the linked server properties in enterprise
> manager
> the third option "be made using the logon's current security context" is
> selected.
>
> any ideas???
>
> cheers
>
> martin.
>
>
>
>
> "Uri Dimant" wrote in message
>
>> Martin
>>
>> I did just some testing and it worked fine
>>
>> EXEC sp_addlinkedserver @server='server1', @srvproduct='',
>> @provider='SQLOLEDB', @datasrc='myserver'
>>
>>
>> select * from server1.demo.dbo.t1
>>
>>
>> In your case you used two different providers to create a linked server
>> (SQLOLEDB,MSDASQL)
>>
>> Make sure that your server name is 'Developement'. Try connect as
>> (local)
>> EXEC sp_addlinkedserver @server='link', @srvproduct='',
>> @provider='SQLOLEDB', @datasrc='local'
>>
>>
>>
>>
>>
>>
>>
>>
>> "Martin" wrote in
>> message
>>
>> > Hi,
>> >
>> > I am setting up a linked server on my local SQL server 2000 development
>> > machine.
>> > The server is linking to itself and I am setting this up soley for
>> > learning
>> > purposes.
>> >
>> > I first used the command
>> >
>> > Exec sp_addlinkedserver @server='link' , @srvproduct='SQLServer OLEDB
>> > Provider' , @provider='SQLOLEDB' , @datasrc='Developement'
>> >
>> > which worked (ie added the linked server - I verified this by running
> EXEC
>> > sp_linkedservers), but when I ran the following query
>> >
>> > select CustomerID, CompanyName from link.northwind.dbo.Customers
>> >
>> > I was given the error message
>> >
>> > SQL Server does not exist or access denied.
>> >
>> > This seemed strange as my security credentials should be the same on
>> > the
>> > linked server and the local server as they are basically both the same
>> > machine.
>> > I am using intergrated security.
>> > Incidently the method above i got from my wrox press sql server 2000
> book
>> > and this eems to work fine in the book.
>> >
>> > secondly I used the following command to add a linked server back to
>> > itself
>> >
>> > EXEC sp_addlinkedserver
>> > @server = 'self',
>> > @srvproduct = '',
>> > @provider = 'MSDASQL',
>> > @datasrc = NULL,
>> > @location = NULL,
>> > @provstr = 'DRIVER={SQL Server};Server=(local); Initial
>> > Catalog=master;Integrated Security=SSPI;'
>> >
>> > I then ran my query
>> >
>> > select CustomerID, CompanyName from link.northwind.dbo.Customers
>> >
>> > which returned the results I was expecting.
>> >
>> > I would like to ask what I did wrong in the first example.
>> > as the user accounts are the same on the linked server and local
>> > machine
>> > (they are basically both the same instance) I am a little stumped.
>> >
>> > thanks in advance
>> >
>> > cheers
>> >
>> > martin.
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>>
>>
>
> >> Stay informed about: Self Linked Server |
|
| Back to top |
|
 |  |
External

Since: Apr 18, 2007 Posts: 14
|
(Msg. 7) Posted: Sun Jan 21, 2007 9:19 pm
Post subject: Re: Self Linked Server [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Hi razvan,
my computer is called "Development"
The third option "be made using the logon's current security context" is
checked in enterprise manager.
cheers
martin.
"Razvan Socol" wrote in message
> Hi, Martin
>
> Is your computer name "Development" ? If no, replace the @datasrc with
> your computer name.
>
> If yes, check the current setting for the logins mapping, using
> Management Studio or Enterprise Manager, in the Security page of the
> linked server properties. The third option should be checked "Be made
> using the login's current security context".
>
> Razvan
> >> Stay informed about: Self Linked Server |
|
| Back to top |
|
 |  |
External

Since: Apr 18, 2007 Posts: 14
|
(Msg. 8) Posted: Sun Jan 21, 2007 10:26 pm
Post subject: Re: Self Linked Server [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Thanks for your help, that works.
"Uri Dimant" wrote in message
> How about
> EXEC sp_addlinkedserver @server='link2', @srvproduct='',
> @provider='SQLOLEDB', @datasrc='(local)'
>
> select CustomerID, CompanyName from link2.northwind.dbo.Customers
>
>
> "Martin" wrote in message
>
> > Hi Uri,
> >
> >
> > just ran the following
> >
> > EXEC sp_addlinkedserver @server='link2', @srvproduct='',
> > @provider='SQLOLEDB', @datasrc='local'
> >
> > and then the command
> >
> > select CustomerID, CompanyName from link2.northwind.dbo.Customers
> >
> >
> > still get the error message
> >
> > Server: Msg 17, Level 16, State 1, Line 1
> > SQL Server does not exist or access denied.
> >
> > ran EXEC sp_linkedservers to check the linked server exists and it does.
> >
> > checked the security page of the linked server properties in enterprise
> > manager
> > the third option "be made using the logon's current security context" is
> > selected.
> >
> > any ideas???
> >
> > cheers
> >
> > martin.
> >
> >
> >
> >
> > "Uri Dimant" wrote in message
> >
> >> Martin
> >>
> >> I did just some testing and it worked fine
> >>
> >> EXEC sp_addlinkedserver @server='server1', @srvproduct='',
> >> @provider='SQLOLEDB',
@datasrc='myserver'
> >>
> >>
> >> select * from server1.demo.dbo.t1
> >>
> >>
> >> In your case you used two different providers to create a linked
server
> >> (SQLOLEDB,MSDASQL)
> >>
> >> Make sure that your server name is 'Developement'. Try connect as
> >> (local)
> >> EXEC sp_addlinkedserver @server='link', @srvproduct='',
> >> @provider='SQLOLEDB', @datasrc='local'
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> "Martin" wrote in
> >> message
> >>
> >> > Hi,
> >> >
> >> > I am setting up a linked server on my local SQL server 2000
development
> >> > machine.
> >> > The server is linking to itself and I am setting this up soley for
> >> > learning
> >> > purposes.
> >> >
> >> > I first used the command
> >> >
> >> > Exec sp_addlinkedserver @server='link' , @srvproduct='SQLServer OLEDB
> >> > Provider' , @provider='SQLOLEDB' , @datasrc='Developement'
> >> >
> >> > which worked (ie added the linked server - I verified this by running
> > EXEC
> >> > sp_linkedservers), but when I ran the following query
> >> >
> >> > select CustomerID, CompanyName from link.northwind.dbo.Customers
> >> >
> >> > I was given the error message
> >> >
> >> > SQL Server does not exist or access denied.
> >> >
> >> > This seemed strange as my security credentials should be the same on
> >> > the
> >> > linked server and the local server as they are basically both the
same
> >> > machine.
> >> > I am using intergrated security.
> >> > Incidently the method above i got from my wrox press sql server 2000
> > book
> >> > and this eems to work fine in the book.
> >> >
> >> > secondly I used the following command to add a linked server back to
> >> > itself
> >> >
> >> > EXEC sp_addlinkedserver
> >> > @server = 'self',
> >> > @srvproduct = '',
> >> > @provider = 'MSDASQL',
> >> > @datasrc = NULL,
> >> > @location = NULL,
> >> > @provstr = 'DRIVER={SQL Server};Server=(local); Initial
> >> > Catalog=master;Integrated Security=SSPI;'
> >> >
> >> > I then ran my query
> >> >
> >> > select CustomerID, CompanyName from link.northwind.dbo.Customers
> >> >
> >> > which returned the results I was expecting.
> >> >
> >> > I would like to ask what I did wrong in the first example.
> >> > as the user accounts are the same on the linked server and local
> >> > machine
> >> > (they are basically both the same instance) I am a little stumped.
> >> >
> >> > thanks in advance
> >> >
> >> > cheers
> >> >
> >> > martin.
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >>
> >>
> >
> >
>
> >> Stay informed about: Self Linked Server |
|
| Back to top |
|
 |  |
External

Since: Apr 18, 2007 Posts: 14
|
(Msg. 9) Posted: Sun Jan 21, 2007 10:27 pm
Post subject: Re: Self Linked Server [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
working now,
thanks for your help
"Razvan Socol" wrote in message
> Hi, Martin
>
> The following works for me, on both SQL Server 2000 (8.00.2039) and SQL
> Server 2005 (9.00.3033):
>
> EXEC sp_addlinkedserver @server='myself', @srvproduct='',
> @provider='SQLOLEDB', @datasrc='(local)'
> go
> select * from myself.Northwind.dbo.Customers
> go
> EXEC sp_dropserver 'myself'
>
> Razvan
> >> Stay informed about: Self Linked Server |
|
| Back to top |
|
 |  |
| Related Topics: | Linked server - HI, Is there a way to create a linked server to dbase files. I need to be able to import data from dbase files on a regular basis, once the data has been imported it then needs to go through a verification and transformation, then finally imported to th...
Linked Server - I have connected a 3rd party ODBC via Linked Server How do I now reference a table in the Kinked Server using TSQL Eg Linked Server Name = Test1 Table name = testTBL select * from TestTBL what is the correct syntax Or is there a better way to do..
Linked server - Hi Please Help on this .while am runing query. inside query Linked server is made Server: Msg 7347, Level 16, State 1, Line 1 OLE DB provider 'SQLOLEDB' returned an unexpected data length for the fixed-length column..
linked server dynamic SQL help - declare @var varchar(50) select @var='ServerA' select name from @var.master.dbo.sysobjects -- Need help here Right now its just one server but eventually i want to probably use a group of servers and kinda use a cursor.
Using a Linked Server in a query... - Hi there. Here's a question that I probably should know the answer to but.... Anyways: If I want to use Linked servers in some simple queries (select * from table...), do I need to have MSDTC running? In other words, do I need MSDTC even if I'm not.. |
|
You can post new topics in this forum You can reply to topics in this forum You can edit your posts in this forum You can delete your posts in this forum You can vote in polls in this forum
|
|
|
|
 |
|
|