2
votes

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?

2
Are you sure you defined System DSN TestDB using c:\windows\sysWOW64\odbcad32.exe (it is 32 bit ODBC Data Source Administrator)? Have you tested it with "Apply & Test Connection" button?Michał Niklas
@HansPassant I don't think that is my issue. I can't install DSN on 64bit ODBC because there is no Informix Driver. In my case my 32bit service can't work with 32bit ODBC.Alexey Emelyanov
@MichałNiklas Yes. I'm sure that i use 32 bit ODBC Data Source Administrator. I've checked it again. 'Apply & Test Connection' says that connection works well.Alexey Emelyanov
Since june 2014, there is a informix Client sdk, Version 4.1. The Installation will install an 64bit odbc driver. Download from informix download center. It does solve my odbc Problem on win server 2012. Driver Name is the same as 32bit. (without 64 Bit in the name, as shown in 64bit odbc manager)ChristianNRW

2 Answers

1
votes

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.

0
votes

ODBC Data Source Administrator is different for 32bit and 64bit drivers.
ODBC 64bit driver use c:\windows\system32\odbcad32.exe
and for
ODBC 32bit driver use c:\windows\sysWOW64\odbcad32.exe