Solved

ODBC Text driver Error

Posted on 2011-09-26
6
2,030 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Azure Web App - HTTP Redirect - web.config file help 23 62
AJAX Create / Update Not working MVC 5 67
Data Analysis 7 59
How does GeoJson relates to Leaflet and Mapbox? 4 50
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…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

752 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