Link to home
Start Free TrialLog in
Avatar of Haakon_Rmd
Haakon_Rmd

asked on

Connecting to MS SQL db from Win32 application written in C

We have a main application written in C (Win32), with a custom, ISAM database.

We are in a windows environment with clients mainly using win7, and 2 clients still using XP. After switching our network file server to Win2012R2 we exeprienced random network slowdowns, and db corruptions which I think are caused by conflict in how our db works and SMB2 and 3 are designed to work.

For that reason we are exploring our options, and think we could do following:
1. Switch db to SQL
2. use linux as a file server and turn off SMB2 for db files, and user cashing
3. use existing server but switch SMB2 off and user cashing.

I think turning off cashing and SMB2 could cause other problems, so I would like to start converting some of data into SQL type of database, and would use full blown Microsoft SQL server.

We will not rewrite main application in another language, as that would take years.

1. Do I have another option except #3?
2. If I do attempt #3, what are my options, considering the code is done in C? We are currently using Visual Studio 2013 for development, and obviously can easily add C++ files to existing C project.

Thanks in advance to anybody who takes time to try to help me with this. If you have links to existing examples, that would be great.
Avatar of Pavel Celba
Pavel Celba
Flag of Czechia image

"Do I have another option except #3"?  Interesting question... So beside options #1 and #2 you can run the app in terminal services mode. Install the app and data on the same server and allow users to execute the app via Remote Desktop connection. App running in Remote Desktop does not use network access to your data and problems caused by SMB2,3 and oplocks are gone.

If you do attempt #3 then there are no options in your C code. Switching SMB2 off is outside the app code. I don't know what you mean by user caching but when you try to create some data cache on local harddrive then it will need certain app data access redesign and depends on your app how this will be achievable.

Centralized server seems to be the only supported data access method in Microsoft today. To call ODBC drivers from C language is relatively easy and straight forward way BUT it will need app code update because ODBC data access works differently than direct file access in ISAM database. Good start is e.g. here: http://www.easysoft.com/developer/languages/c/odbc_tutorial.html
Avatar of Haakon_Rmd
Haakon_Rmd

ASKER

Thank You pcelba.

I meant cashing as a part of SMB2 that happens on client.

I believe remote desktop would be quite slow.

Would you or anybody else know, if we take an option #2, linux server, do we need to make any modifications on clients, or we can turn off oplocks and SMB2 completely only on server, and that will be enough?

I guess the best would be if actually somebody tried to have two servers at the same time, and provides an answer. Windows network, and linux as only a file server.
ASKER CERTIFIED SOLUTION
Avatar of Pavel Celba
Pavel Celba
Flag of Czechia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial