Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ODBC Text driver Error

Posted on 2011-09-26
6
Medium Priority
?
2,142 Views
Last Modified: 2012-05-12
I have a web app that allows the upload of a csv file that is then processed by the web server.  The script works, but, it takes a very long time, so I am attempting to place it in a new thread.  When I do that, I receive the following error.

System.Data.Odbc.OdbcException (0x80131937): ERROR [HY024] [Microsoft][ODBC Text Driver] '(unknown)' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed

Here is the code.

Dim connODBC As New System.Data.Odbc.OdbcConnection("Driver={Microsoft Access Text Driver (*.txt, *.csv)};Dbq=" & ShortCuts.RootPath & "Assets\87\adults\;Extensions=csv;")
            Dim sql As String = "SELECT  RIGHT('00000000000'+ [ID],12) as [legacyId], " & _
            "[Service Unit], " & _
            "Troop, " & _
            "[Last Name], " & _
            "MI, " & _
            "[First Name], " & _
            "Street, " & _
            "Apt, " & _
            "City, " & _
            "State, " & _
            "Zip, " & _
            "[Home Phone], " & _
            "[Work Phone], " & _
            "Email, " & _
            "Race, " & _
            "Ethnicity, " & _
            "PC " & _
             "FROM adults.csv"

            Dim da As New Odbc.OdbcDataAdapter(sql, connODBC)
            connODBC.Open()

The error occurs on the Open() command.

The only other thing that might be playing into this is the file is stored on a UNC path.

The script is running on IIS 7, .net 4, windows 2008 server (64bit).  The file server is Windows 2003 server.

Thanks for your assistance.
0
Comment
Question by:dbashley1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 5

Expert Comment

by:almander
ID: 36599744
What does the value of connODBC's connectionstring property look like?
0
 

Author Comment

by:dbashley1
ID: 36599794
The connection string is

Driver={Microsoft Access Text Driver (*.txt, *.csv)};Dbq=\\10.0.1.41\WebShare\Web40\Assets\87\adults\Assets\87\adults\;Extensions=csv;")
0
 
LVL 5

Expert Comment

by:almander
ID: 36600637
Assuming that this code worked before putting it in a new thread, It sounds like the Context that the new thread is running under does not have access to the shared computer.

0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 

Author Comment

by:dbashley1
ID: 36600645
So how do set the context of the new thread?  Or determine why it doesn't have permission?
0
 
LVL 5

Accepted Solution

by:
almander earned 2000 total points
ID: 36601128
Hopefully we are on the right track:
The first question is if the Identities are different in the main thread, and the new thread.
You can inspect the identities using,
System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString()
or
System.Threading.Thread.CurrentPrincipal.Identity.Name.ToString()

I am not sure how you are creating your new thread. But if you want the new thread to impersonate the calling thread, these links may help.
http://blogs.iis.net/sakyad/archive/2008/11/19/process-and-thread-identity-in-asp-net-a-practical-approach.aspx

http://www.velocityreviews.com/forums/t119757-threading-and-impersonation.html

http://msdn.microsoft.com/en-us/library/xh507fc5.aspx

0
 

Author Closing Comment

by:dbashley1
ID: 36601808
Excellent info.  Took care of the problem.
0

Featured Post

Vim Reference Guide

Vim is a powerful text editor favored by many sysadmins and developers - here are some commands that you'll want to keep in your back pocket!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Prologue It is often required to host multiple websites on a single instance of IIS, mostly in development environments instead of on production servers. I am sure it is not much a preferred solution on production servers but this is at least a pos…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

721 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