Error trying to create CSV file using Jet 4.0

I am successfully creating a CSV file using the Jet 4.0 driver on my development machine but the process fails on the customer's machine.

First I create a schema.ini file in the target folder as follows:


Then, I run the following command against a SQL Server database:

        INSERT INTO OPENROWSET('Microsoft.Jet.OleDB.4.0', 'Text;Database=C:\', [tmpExportFile#csv]) ( [col1], [col2] )  SELECT [mytable].[col1], [mytable].[col2] FROM [mytable]

On my development machine it executes correctly.  However, on the customer's machine the following error occurs:

        OLE DB provider 'Microsoft.Jet.OleDB.4.0' does not contain table 'tmpExportFile#csv'.  The table either does not exist or the current user does not have permissions on that table.
        OLE DB error trace [Non-interface error:  OLE DB provider does not contain the table: ProviderName='Microsoft.Jet.OleDB.4.0', TableName='tmpExportFile#csv'].

Changing the output folder to "NewFolder" causes a different error

        INSERT INTO OPENROWSET('Microsoft.Jet.OleDB.4.0', 'Text;Database=C:\NewFolder', [tmpExportFile#csv]) ( [col1], [col2] )  SELECT [mytable].[col1], [mytable].[col2] FROM [mytable]

        db error: OLE DB provider 'Microsoft.Jet.OleDB.4.0' reported an error.  
        OLE DB error trace [OLE/DB Provider 'Microsoft.Jet.OleDB.4.0' IDBInitialize::Initialize returned 0x80004005:   ].
        [OLE/DB provider returned message: 'C:\NewFolder\' 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.]

In both cases the the folders do exist and there is no existing tmpExportFile.csv file.  

Any ideas ???


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I think you must check the path in your OPENROWSET Statement. Create the Folder manually and then fire this and see.
Try using something like this and see, a complete path to file.
USE pubs
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
   'c:\MSOffice\Access\Samples\northwind.mdb';'admin';'mypwd', Orders)
   AS a

Folder does not exists:
check the path in you code, normally ths current path i.e App.Path is taken as default.
you can use File System Object to check the path, if you are using VC or VB.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.