32-bit Text drivers (Microsoft Access , Microsoft Excel and Text files ) from a 64 bit application on windows 7

余生长醉 提交于 2019-12-28 06:27:24

问题


Hi i have an application developed on XP with Text ODBC drivers. But when i deployed on Win 7 with office 2007, i have connection issues.

<add key="SQLConnection.TextConnectionString" value="Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=c:\Data\;Extensions=asc,csv,tab,txt;Persist Security Info=False" />

ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified


i have googled every solutions like installing the following

http://blogs.msdn.com/b/sqlblog/archive/2009/12/29/how-to-connect-to-file-based-data-sources-microsoft-access-microsoft-excel-and-text-files-from-a-64-bit-application.aspx

Microsoft Access Database Engine 2010 Redistributable (32-bit)

2007 Office System Driver: Data Connectivity Components

after all of those, in my datasources(ODBC), it still only shows "SQL native client/SQL server/SQL server native client"

in the C:\Windows\SysWOW64\odbcad32.exe

i can see all the x32 drivers, but how can i modify my connection strings to access 32-bit Microsoft Text Drivers or are there any alternative solutions? Thanks


回答1:


I'm pretty sure it'll work automatically (even on a 64-bit machine) as long as the executing process is 32-bit.

Try recompiling to target x86 specifically.




回答2:


You need the 64-bit Microsoft Access Database Engine 2010 Redistributable

http://www.microsoft.com/downloads/details.aspx?familyid=C06B8369-60DD-4B64-A44B-84B371EDE16D&displaylang=en

Then try

Microsoft Access Text Driver (*.txt, *.csv)

for the driver name.

AFAIK, all 64-bit ODBC drivers from the Microsoft Access Database Engine 2010 64-bit Redistributable have slightly changed their driver names, I guess to differentiate them from their 32-bit counterparts.




回答3:


I had this exact problem and the recompiling to target x86 specifically worked! Note that in order to do this I had to specify the Target CPU in the advanced compiler setting dialog - Project Menu> Properties> Compile tab> Advanced Compile Options button.

Before finding this forum entry I did install the Microsoft Access Database Engine 2010 Redistributable (32-bit) but I don't know if that had any affect on this issue.

As mentioned above, when the executing process is 32-bit (in this case compiling against x86 makes the app 32-bit specific) the application will use the drivers from C:\Windows\SysWOW64\odbcad32.exe.

Thanks Cameron.




回答4:


We were doing this from ASP.Net and got it working on Windows 2012 just by moving the one site into a separate app pool that had "32-bit Enabled" turned on in the advanced settings for the App Pool.




回答5:


A lot of people seem desperate here, I want to offer a few solutions. But, first I want to highlight what a dated proprietary trash idea from the 90s this is.

  1. Use Unix ODBC to host the text file from Linux which the docs (seem to) claim to support an implementation of the Microsoft text driver

  2. A better option would be of course to import the CSV into PostgreSQL.

    1. I would suggest just doing this with \COPY and dropping the notion of a CSV.
    2. You can maintain the CSV with PostgreSQL acting as a server with the Foreign Data Wrapper (file_fdw).
  3. If you don't want to run an RDBMS, the modern way would be to use SQLite. This is a great idea if you don't need the server/client model.

The ODBC->text interface is especially insane, because ODBC doesn't define configuration beyond connection (so I assume there are lots of assumptions there).



来源:https://stackoverflow.com/questions/3454701/32-bit-text-drivers-microsoft-access-microsoft-excel-and-text-files-from-a

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!