Solved

ODBC Text driver Error

Posted on 2011-09-26
6
1,951 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
  • 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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 500 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Running classic asp applications under Windows Server 2008 R2 (x64) and IIS 7 is not as easy as one may think. It took me a while to figure it out while getting error 8002801d a few times. After you install the OS you will need to install the fol…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

910 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

20 Experts available now in Live!

Get 1:1 Help Now