Solved

ODBC Text driver Error

Posted on 2011-09-26
6
2,084 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
Industry Leaders: 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!

 

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

Learn by Doing. Anytime. Anywhere.

Do you like to learn by doing?
Our labs and exercises give you the chance to do just that: Learn by performing actions on real environments.

Hands-on, scenario-based labs give you experience on real environments provided by us so you don't have to worry about breaking anything.

Question has a verified solution.

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

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

635 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