Solved

Best method for setting up Linked Server for SQL Server in Windows 7 64-bit

Posted on 2015-01-28
11
152 Views
Last Modified: 2015-01-29
I want to set up a linked server to a folder containing text files so Microsoft SQL Server 2012 can access the data in them.  The database is installed locally on a 64-bit Windows 7 machine, which has Office 2003 installed.  As I try various things, I'm noticing that much of the documentation online involves old, deprecated drivers/providers, and many of the online forum discussions involve people who want to make it work with a particular driver/provider, where there seem to be many issues getting this done on a 64-bit machine.  I don't care what driver I use.  If I can just download a driver that works and has the fewest setup problems, that would be ideal.

Based on reading about the errors I've gotten, I've tried setting up different DSNs for 32- and 64-bit, downloading new drivers (but since Office 2003 is installed, only 32-bit drivers could be downloaded), giving all users access to the directory that has the files, giving the SQL Server access to a certain temp directory, etc.

My question, though, is what is the best approach to do this?  Is there some best practice or way to set up linked servers that bypasses the incompatibility between 64- and 32-bit, doesn't make use of deprecated features, and doesn't require wide-open permissions in various temp directories, etc.?  In other words, rather than chasing down a solution to work with a particular driver, is there a better way to do this that's maybe more straightforward and bypasses most incompatibility issues?
0
Comment
Question by:Newbis
  • 5
  • 3
  • 3
11 Comments
 
LVL 32

Expert Comment

by:ste5an
ID: 40577014
Please define: "Microsoft SQL Server 2012 can access the data in them."
0
 

Author Comment

by:Newbis
ID: 40577250
I'm talking about setting up a Linked Server in SQL Server 2012.  Once you set one up, you can query the data in the external source (in this case a text file), without using an ad-hoc solution such as openrowset in your query.  In either case (linked server or openrowset), you have to specify a provider.  When I do, it tends to say that it's not registered, etc.  I'm trying to understand what's the best provider to use these days, with the system configuration mentioned above.
0
 
LVL 32

Expert Comment

by:ste5an
ID: 40577304
I would use SSIS in the first place.  Using OPENROWSET for bulk-imports is ok. I would imagine more problems with a linked server in this case.
0
 
LVL 45

Expert Comment

by:Vitor Montalvão
ID: 40577346
I think you are confusing Linked Server with ODBC and DTEXEC. The last two requires 32b and 64b versions because they are executables (.EXE files).
Linked Server is an object inside the SQL Server so I don't think it has this 32b and 64b issue.
Also, what you really want to achieve here so maybe we can recommend you another solution.
0
 

Author Comment

by:Newbis
ID: 40577507
Well, after discussing this with my manager, it looks as if I'll be using SSIS, more based on the fact that that's what they're more comfortable with in terms of supporting.  The reason why I was thinking of Linked Server is that it seemed from my perspective to be easier to support, before I learned that they're more used to SSIS.  SQL Server's documentation recommends Linked Server over bulk import / openrowset for operations that will be performed regularly; those other two options also require ad hoc distributed queries permission, and I want to keep permissions as limited as possible.

This is for a one-off intranet utility that will interact with a SQL Server database that needs to be loaded with new data from text files in a directory every time someone starts the utility.  So looks as if I will have my .NET code kick off the SSIS package as soon as the request comes in.

When I was trying to do it with a Linked Server or openrowset, when calling sp_addlinkedserver or the wizard, I tried some examples using Jet, or MSDASQL and Microsoft Text Driver, or using ODBC, or various other drivers, and it seemed that rather than debug each one I should try to find which parameters would most likely work best.

So in any case, it looks as if this is lower priority now since we're going to SSIS, but if someone does have an idea of what to use with sp_addlinkedserver that actually works on this particular machine, I'd be interested.  Thanks.
0
Too many email signature updates to deal with?

Do you feel like you are taking up all of your time constantly visiting users’ desks to make changes to email signatures? Wish you could manage all signatures from one central location, easily design them and deploy them quickly to users? Well, there is an easy way!

 
LVL 45

Expert Comment

by:Vitor Montalvão
ID: 40577543
I need to see how are you creating the linked server.
bcp utility should be more easy for importing data from text files.
0
 
LVL 32

Accepted Solution

by:
ste5an earned 250 total points
ID: 40577608
This is for a one-off intranet utility that will interact with a SQL Server database that needs to be loaded with new data from text files in a directory every time someone starts the utility.  So looks as if I will have my .NET code kick off the SSIS package as soon as the request comes in.

It still depends on your concrete needs.

I can imagine doing this entirely in the tool and using the SqlBulkCopy Class. Another possibility could be filling an EF object graph and pushing the data to the server.
0
 

Author Comment

by:Newbis
ID: 40577656
@ste5an:
Thanks for the recommendation on SqlBulkCopy Class.  I like that idea, and might consider it if I have trouble with other ways.  I don't think Entity Framework to connect with the text files would be good, as it seems like too much overhead just to get the data into SQL Server.  But I'm leaning towards SSIS now because then if there's a data problem down the road, they can troubleshoot the package instead of getting into the .NET code.
0
 
LVL 45

Assisted Solution

by:Vitor Montalvão
Vitor Montalvão earned 250 total points
ID: 40577741
Just for information, bcp stands for Bulk Copy Program. It's an .exe file that receives parameters and depending on that will do the job for you so no need for coding.
0
 

Author Comment

by:Newbis
ID: 40578533
I ended up using SqlBulkCopy class and it worked like charm.  Earlier, I had tried SSIS but I got another weird installation error and figured I should be getting this written rather than debugging weird errors with my development machine.  They're okay with that too...at least it keeps everything within the same technology and is also relatively low-level vs. doing some sort of EF solution.
0
 

Author Closing Comment

by:Newbis
ID: 40578541
Although I didn't get an answer to the original question, in the end it doesn't matter. SqlBulkCopy does what I needed, and it's working now.  I like the fact that I don't have to worry about what's installed properly on my machine and get just get something up and working.  thanks.
0

Featured Post

Do email signature updates give you a headache?

Constantly trying to correctly format email signatures? Spending all of your time at every user’s desk to make updates? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today!

Join & Write a Comment

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

706 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

18 Experts available now in Live!

Get 1:1 Help Now