Solved

ODBC Text driver Error

Posted on 2011-09-26
6
1,935 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

What is an ISAPI filter?   •      It's an assembly (.dll file) that can add or change the way IIS works.   •      They can be enabled globally for your web server or on a site-by-site basis.   When the IIS server receives a request, enabling the ISAPI fi…
Lync server 2013 Backup Service Error ID 4049 – After File Share Migration
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

758 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

27 Experts available now in Live!

Get 1:1 Help Now