Dear All,
I am new to Visual C++ 2005 and I would like to write a network application that uses native win32 C++ and that stores and restores data to and from a different databases (depending on the setup). I am planing to make this application portable to be launched and executed on both platforms Windows and Linux.
My question is that is there a generic iterface that enables me to connect the C++ application to an ORACLE or MySQL database (depending on my setup) so that I can restore or store my data using SQL commands from within the C++ program.
Take note that this interface should be compatable with Windows and Linux plateform
Your help is much appreciated.
Regards
Bassam

How to access a database
Miles P. Thornton
Well, let me tell you my story about C++. First of all I am very much familiar with OOP. The last time I touched VC++ 6 was 4 years back when I was building a router lookup algorithm that works on both IPv4 and IPv6, and Java 2 years back. However, I like to work on C++ for its strength.
I have not used template before but I may be using it un my project
WinAPI, there are a alot, like WinSock...etc.
I agree with you, and I think you misunderstood my previous post. The bottleneck is the same whether using native C++ or .NET, but my concern is the processing time inside the application itself apart from the database database fetching time.
However, I visited the Performance link, it has changed my mind about .NET technology, but still I need to use native C++ cause I am not familiar and attuned with .NET technology. Morever, I don't have time to learn it. :)
Also, C++ is an intermediate level language, not like the other high level languages like Java, VB, etc. The is another reason that is pushing me to use native C++.
I am going to use the ODBC since it is supported natively by both platforms.
Where can I get tutorials that teach step by step on how to use these APIs (ODBC, ADO, ADO.NET and OLEDB), I would appreciate if you mentioned to me some of them. In fact I went through the MSDN help and tried to learn how to use them, but I found it very complicated with a very few examples, especially the ADO and ADO.NET examples that are based on VB.
josechu
Are you going to be using ODBC, ADO, or ADO.NET Will you have MFC/.NET/Mono/ATL available
If I were doing the project, I would always choose ADO.NET (possibly with the help of mono if I were going to port to Linux).
Help_is_forever
steve777
Jordan Y
How much Visual C++ do you know are you familiar with OOP What about template programming And how much of the WinAPI do you know
Care to show evidence affirming this Since you are accessing a database, your bottleneck is going to be with IO, not with the CPU. For commercial purposes, .NET will be a viable option to allow you to rival "other products".
You should take a look at Performance Quiz #6 by Rico Mariani. It shows that for complex applications, .NET can outperform even the most heavily optimised C++ application. And for Database access, you're going to be spending most of your time waiting for the DB to respond.
But .NET performance FUD aside, if you really are worried about performance, and assuming that the choice of language really matters (I still don't see how C++ is going to make DB Access faster), you've made the wrong choice by choosing C++.
For Oracle, the best performance is going to be gained by using its language of choice: Java/JDBC. The fastest language for working with MySQL is PHP. And for flat files... ASM might be the fastest choice.
I feel you're greater objection with .NET is due to this...
Your choices are ADO.NET (using Mono to make it work in Linux), OLEDB (using either Wine or ADODB for Linux), and ODBC (the only one supported natively by both linux and windows).
If you want to change the storage from ORACLE to MySQL (or whatever), all you have to do is change the connection string (and make sure you're using compatible SQL statements).
Note that OLEDB has a wrapper for ODBC DB sources, thus making it essentially ODBC and more. Likewise, ADO.NET has ODBC and OLEDB wrappers, which makes it ODBC/OLEDB and more.
PDMG
Before starting you should consider writing the DB part in another language, and write your app logic in C++.
A HUGE number of applications (including Visual Studio itself) are written in this way (in multiple languages). If nothing else, at least it enforces the separation of application logic from the data layer.
If you still want to program with ODBC, please, for the reliability, security and maintainability of your own program, find an ODBC library/framework to help you. If you're going to reinvent the wheel and write your own ODBC function, it's just going to be an inferior (and less stable) clone of the numerous other libraries out there.
I've already named two wrapper libraries you can use: ADO and ADO.NET (yes, these can act as ODBC libraries).
Sajid Ahmed
Bassam, you might want consider to ask the same issue on the Data Access newsgroups at http://msdn.microsoft.com/newsgroups/topic.aspx url=/MSDN-FILES/028/201/006/topic.xml. Folks there might have more details.
Thanks, Ayman Shoukry VC++ TeamLi Kuan
As an experienced person on Database API, Which one do you prefer for the ease of use, ODBC or ADO
Can you refer for an online tutorial other than the msdn on how to use the database APIs
Thanks for your support
Bassam
andreas s
Dear OShah and All,
As I said in the first post that I am new to Visual C++ and I would appreciate if you explain and direct me for the best way in order to implemet my project.
Since the project that I am intended to build is a network application, minimizing processing time is a crusial issue. As you know that .NET technology added a processing overhead to applications based on, and that wouldn't be commercially useful to me if I want to rival with other similar products. This is the reasoning behind my dicision of using native C++.
Now, back to the choices that have been offered and apart of the ADO.NET, which one is the best to use, is it ODBC or ADO. Are bothe compatable with Windows and Linux
Take note that for the coast effective issues, the staorage might be ORACLE, MySQL or flat files, depending on the configurations during the installation of the application.
I would appreciate your help regarding this matter.
Bassam
afields
Hervé ANCHER