Solved

Linked Servers Between Local SQLExpress 2008 & Remote SQL2008?

Posted on 2010-09-24
3
1,002 Views
Last Modified: 2012-05-10
This code worked linking two local SQLExpress 2005 on two seperate PCs. However, I cannot get connection to work while testing from Local SQLExpress and Interent remote SQL 2008 Server.

I have tcp1433 open.
The following code runs 'Successfully' without errors

Linked Server show locally: select * from master..sysservers

[Code That Worked - Local to Local SQLExpress 2005 From C# App]
Exec sp_addlinkedserver @server = '" + remotePcName + "', @srvproduct = '', @provider = 'SQLNCLI', " +
@" @provstr = 'DRIVER={SQL Server};SERVER=" + remotePcName + @"\SQLEXPRESS;Trusted_Connection=yes;'

[Code 'Attempt' Local SQLExpress 2008 to Remote SQL 2008 From MS Mgt Studio 2008]
Exec sp_addlinkedserver
@server = 'RemoteSql', --friendly name
@srvproduct = '',
@provider = 'SQLNCLI',
@provstr = 'DRIVER={SQL Server};Server=tcp:sql2k801.discountasp.net;Initial Catalog=SQL2008_123456_database1;User ID=mysecretid;Password=mysecretpassword;'

I contacted DiscountASP support (no help), did find linked servers are allowed (kb articles).

Help EE....
0
Comment
Question by:pointeman
  • 2
3 Comments
 
LVL 15

Expert Comment

by:MohammedU
Comment Utility
I believe remote connections are disabled in SQL Express by default...
Make sure you enable remote connections...
check the following blog for how enable...

http://blogs.msdn.com/b/sqlexpress/archive/2005/05/05/415084.aspx
0
 

Author Comment

by:pointeman
Comment Utility
Untrusted domain errors now.
0
 

Accepted Solution

by:
pointeman earned 0 total points
Comment Utility
SOLUTION:
Before runing sp_addlinkedserver or doing anything else, perform the following task:
1. Login to SQL Server Management Studio 2008 as 'Administrator' ( Windows Authentication or SA)
2. Go to Securtiy -> Logins: create login using same 'user id' and 'password' as Remote login
3. Assign role 'sysadmin' and default database 'master'
4. Logout and LOGIN as the newly created login user and password
5. Now run sp_addlinkedserver
6. Go to Server Objects -> Linked Servers -> mylinkedservername -> remotedbname -> Tables (All show)
7. Run this query: use master;  Select * From mylinkedservername.master.dbo.sysdatabases (approx 3 rows show)
8. Run this query: Select * From mylinkedservername.remotedbname.dbo.mytablename (returns all rows)
This worked for me, hope I didn't miss anything, details... details...
 
 
 
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduced in Microsoft SQL Server 2005, the Copy Database Wizard (http://msdn.microsoft.com/en-us/library/ms188664.aspx) is useful in copying databases and associated objects between SQL instances; therefore, it is a good migration and upgrade tool…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now