Solved

Converting from CRecordset (ODBC) to OLEDB

Posted on 2001-07-03
10
579 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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Creating Labels and Frequency list style reports in SAS code 9 105
Detect CR LF to each line 12 170
NotAlone Challenge 20 84
Line meaning 9 87
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

860 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