Solved

Converting from CRecordset (ODBC) to OLEDB

Posted on 2001-07-03
10
581 Views
Last Modified: 2013-11-20
Our project has many MFC CRecordset derived classes used for accessing our backend SQL Server database. Our program runs on NT/95 machines.

Is there an easy way to switch to OLEDB in our environment? If not, does anyone know of any code that replaces the MFC CRecordset functionality? Does anyone have any other suggestions?

Thanks :)
0
Comment
Question by:SteveGTR
  • 6
  • 4
10 Comments
 
LVL 49

Expert Comment

by:DanRollins
ID: 6250126
I have played with ADO _Recordset and found it a royal pain to use -- all that conversion to and from BSTRs for one thing.  For another, CRecordset provides nice clean class member variables for each field... other alternatives make you use database field names (advantageous sometimes, sometimes not).  Also, C++ sucks at accessing even the simplest of COM objects... it's a real shame we need to write wrappers to make anything usable -- VB users laugh at our struggles).  

What is your goal?  That is, why do you want to switch from CRecordset to something else?  

-- Dan
0
 
LVL 30

Author Comment

by:SteveGTR
ID: 6250174
Good question Dan. One of our developers said that OLEDB is about 10 times faster than ODBC. I've done some testing and OLEDB is pretty fast. Our application consists of about 100 sites with their own databases. The sites replicate data to and from each other (two way merge replication). One of the problems we deal with is record ownership, i.e. who can update a record. Having a central database or a number of shared databases would resolve this issue. But, the access speed using ODBC over T1's or worse 56K modems would be painfully slow. We thought that the performance gained by using OLEDB could make this speed issue moot and that it could solve the record ownership issue.
0
 
LVL 30

Author Comment

by:SteveGTR
ID: 6250215
Good question Dan. One of our developers said that OLEDB is about 10 times faster than ODBC. I've done some testing and OLEDB is pretty fast. Our application consists of about 100 sites with their own databases. The sites replicate data to and from each other (two way merge replication). One of the problems we deal with is record ownership, i.e. who can update a record. Having a central database or a number of shared databases would resolve this issue. But, the access speed using ODBC over T1's or worse 56K modems would be painfully slow. We thought that the performance gained by using OLEDB could make this speed issue moot and that it could solve the record ownership issue.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 30

Author Comment

by:SteveGTR
ID: 6250221
I finally see how these double comments occur. I submitted the comment. Did some work. Came back and pressed refresh. The browers asked if I wanted to repost and I said sure. Double comment...
0
 
LVL 49

Accepted Solution

by:
DanRollins earned 300 total points
ID: 6250584
I would be surprised to learn that the use of OLE Db is that much faster than ODBC.  Perhaps in cetain types of operations, but probably not for standard db access scenarios.  

Consider that at some level, it boils down to passing an SQL command to some program that knows what to do with it.  You can wrap 100 layers of software around that and it won't put in dent in the time used up by network latency.

I can imagine that bulk operations and/or local caching and/or other settings w/could be optimized through OLE DB access.  But there might be simpler options -- such as selecting an appropriate cursor library or access mode when you open the database -- that would clear up performance problems.

I'll tell you this:  I'd certainly write up a proof-of-concept test suite -- and verify the accuracy of its results -- before I started converting my 100,000 lines of ODBC code!

-- Dan
0
 
LVL 30

Author Comment

by:SteveGTR
ID: 6250964
Dan, thanks for your input. Your point about converting mass amounts of code was my reason for submitting this query. The core of my question consisted in these three questions:

1) Is there an easy way to switch to OLEDB in our environment?
2) If not, does anyone know of any code that replaces the MFC CRecordset functionality?
3) Does anyone have any other suggestions?

I think you touched on question three and I really appreciate it. I'll pass along your comments.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 6251927
One thought on item 2...
A goodly portion of CRecordset's functionality is that the Wizard will build and maintain the data members (automatically connecting to the data source and obtaining field info and adding the data transfer mechanism).  Short of writing a custom add-in for VC++, I think you will end up losing this functionality.

-- Dan
0
 
LVL 30

Author Comment

by:SteveGTR
ID: 6308758
Well Dan, there have been no responses aside from yours. I appreciate your help and would be willing to give you the 300 points. Let me know and I'll do whatever you suggest. Thanks again :)
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 6309893
If you are short on points, then feel free to delete the question.   However...

I suggest that you give me the 300 points and a grade of A.  Why?  Because an A cost you no more than a B or C and I need the points if I'm to reach #2 position in the MFC section top 15.

You will be assured that I'll jump in on your next question and you'll have the extreme pleasure of knowing that you contributed to a worthy cause :)

-- Dan
0
 
LVL 30

Author Comment

by:SteveGTR
ID: 6310865
Sold to Dan for 300 points!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Expand LInux Boot partition remotly 3 102
Complete beginner needs help making a cron job 9 129
NotAlone Challenge 20 87
unix example issues 18 106
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question