Results 1 to 4 of 4
  1. #1

    ADODB Record Set using Microsoft Text Driver

    Okay... the subject line doesn't allow enough text for the actual problem.

    As mentioned, I'm using an ADODB.Connection to return an ADODB.Recordset object based upon running a SELECT statement against a CSV file. So far so good, right? This much works fine...

    ...the problem happens if I have to different workstations essentially accessing the same CSV file. The first one to hit the CSV has no problem. The second one to hit, if the first one still is reading records from the recordset, gets the following error:

    [ QUOTE ]
    Microsoft OLE DB Provider for ODBC Drivers [Microsoft][ODBC Text Driver] The Microsoft Jet database engine cannot open the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view its data.

    [/ QUOTE ]

    The CSV file is stored on a server drive and the user logged into the workstation has full read/write access to the files on that drive location. I don't have any explicit ODBC driver settings setup in the control panel.

    Is there anything I can set on the Connection object, either on the object itself or in the connection string, that will allow two workstations to hit the same file at the same time?

    Another configuration I've tried is that, instead of calling ADODB.Connection.Execute to return the record set, I've called ADODB.RecordSet.Open, passing in the conneciton, and setting the recordset mode to a optimistic lock.

    Anyone got any ideas?
    -Robert Martin
    Automated Testing Evangelists
    TestComplete "expert"
    Definition expert - noun - Unknown drip under pressure

  2. #2
    Senior Member
    Join Date
    Oct 2005
    London, U.K

    Re: ADODB Record Set using Microsoft Text Driver

    I don't think you can (At least not that I have found). I guess the optimistic lock idea doesn't work, because you don't get past the connection stage.

    You could try saving as excel shared workbook instead (Not sure that would work either as ADO doesn't actually open the file).

    Only other option would be to add error handling when file in use.

  3. #3

    Re: ADODB Record Set using Microsoft Text Driver

    Things to try:
    - setting the cursortype to static (takes a copy of the data, which might release control?)
    - setting the cursorlocation (you have to use a static type)

    Do you need to write the data back again? If not you could open the connection, get the recordset, load it into an array and close the connection. Leaving it available for others to connect to.
    Everywhere's within walking distance if you have enough time.

  4. #4
    Join Date
    Sep 2006
    Germany, Dresden

    Re: ADODB Record Set using Microsoft Text Driver

    Or write a wait function, that waits until file accessible.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
BetaSoft Inc.
All times are GMT -8. The time now is 07:21 PM.

Copyright BetaSoft Inc.