Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
140 views
in Technique[技术] by (71.8m points)

c# - .NET application into 64-Bit: ODBC problem

I am currently working on a bigger .NET application provided from a company. When handling with a big amount of data there is the problem that the system runs out of memory. After some research I have decided to take the step and change the target platform of the application to 64-Bit. In Visual Studio 2017 there is the possibility to change the platform of the projects... . When starting to build the application I get the warning CNDL1138 a few times within the output console but the build is successful anyway. When starting the application I get different error/exception messages:

  • Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll
  • Exception thrown: 'System.Data.Odbc.OdbcException' in System.Data.dll
  • Exception thrown: 'System.Data.Odbc.OdbcException' in System.Data.dll
  • Exception thrown: 'System.InvalidOperationException' in System.Windows.Forms.dll

So I started to solve the problems step by step. The first thing I tried to solve was the ODCB problem. When starting the problem a pop up window says that there is a mismatch between driver and application. But I have checked the drivers installed they are 64-Bit like the application. I have no clue what the problem could be with the drivers.

So is here anyone with the same problem and could solve it?

(Addition information: I am using Visual Studio 2017, .NET Framework 4.6.1, and programming on C#)

question from:https://stackoverflow.com/questions/66060514/net-application-into-64-bit-odbc-problem

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

As you might know Odbc is a standardized database interface. For it to work it needs a driver specific to the actual database engine.

A specific problem I know about is the access odbc engine. The JET driver used to be common, but it is 32 bit only. A replacement is the ACE driver, that exists in both x64 and x86 variants. This needs to be installed on the system using the redistributable, as far as I know there is no legal way to just include the dll files in the application. It is also included in office installations ( at least the variant I used at the time ), but office uses x86 variants of all components by default, you need to explicitly select x64 during installation.

I think you can install the x64 redistributable ace driver side by side of a office x86 installation, but my memory might be faulty.

I have no idea if there are similar problems with the oracle driver. I would suspect the issue is simpler with the MSSQL driver since 64-bit operation has been standard for a much longer time.

.Net will resolve most dependencies on demand, typically this would be done when the first piece of code that uses the dependency is compiled, i.e. before the first time it is run. A way to check what driver is causing you issues would be to check where the exception occurs, i.e. what kind of database did it try to use.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...