ODBC .NET 32 bit and 64 bit
Please help me!
I have WindowsService that is compiled with Platform Target = x86. This service works with ODBC driver. On the server i have 32 and 64 bit ODBC managers. On 32 bit ODBC driver i have installed Informix Drivers and System DSN=TestDb. On 64 bit - nothing installed. No DSN, no drivers. When i try to run a query via my Windows Service it returns the error:
ERROR [IM014] [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application
So i compiled my Service with Target Platform = x64 and run on this server. Tried the same query with the same DSN = testDb. I got error:
ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
I found 3rd part app for ODBC Explorer and try run the query it works fine.
I'm not sure that I can install Informix Driver for ODBC 64bit, and i want make my service work in all cases like this.
In Code i use OdbcConnection
class. Any ideas?
I found out the issue. Thx, @HansPassant, your link makes me think in right way. I checked in Task Manager on the server the process of my Windows Service. It works as 64 bit application! I checked it on my machine and it works as 32 bit app. (in Task Manager it is shown as '...exe *32' process). So i find here Forcing a .Net Windows service to run as 32-bit on a 64-bit machine how to make Windows start my app as 32bit service. And now my WindowsService works with 32bit ODBC and do queries.
Thank you.
ODBC Data Source Administrator is different for 32bit and 64bit drivers.
ODBC 64bit driver use c:windowssystem32odbcad32.exe
and for
ODBC 32bit driver use c:windowssysWOW64odbcad32.exe
上一篇: Windows 7 64位上的ODBC DSN使用SysWow64 / odbcad32.exe
下一篇: ODBC .NET 32位和64位