Intefacing a database with ANSI C++
-
Hi !! I don't have any idea of how to do it, but here is something I'd like to do : - Develop an app in C++, which would be portable for Windows and Linux. - This app would have to interface a database (Oracle ? Any better database ?) I would appreciate any hints on how to do it, or places where I could start searching. Thanks ! Jerome
-
Hi !! I don't have any idea of how to do it, but here is something I'd like to do : - Develop an app in C++, which would be portable for Windows and Linux. - This app would have to interface a database (Oracle ? Any better database ?) I would appreciate any hints on how to do it, or places where I could start searching. Thanks ! Jerome
The following class libraries may help:
-
The following class libraries may help:
Thanks for the quick answer ! I'm sure I'll find plenty of usefull informations in the links you provided. A question comes to my mind though...Is ODBC the only way to do it ? Or is it the easiest ? Does it exists on Linux ? Thanks again for your help ! Jerome
-
Hi !! I don't have any idea of how to do it, but here is something I'd like to do : - Develop an app in C++, which would be portable for Windows and Linux. - This app would have to interface a database (Oracle ? Any better database ?) I would appreciate any hints on how to do it, or places where I could start searching. Thanks ! Jerome
If you know what DB you will use and you know it won't change, you can use the API of your DB. I think most of the known DBs have at least a C Interface you can use. For Oracle look for OCI (Oracle Call Interface) in the Oracle-Docs (online at otn.oracle.com[^] ) <--edit--> Forgot to mention Pro*C/C++ Precompiler for Oracle. With this precompiler you can write your SQL-Statemetns simply into your C/C++ code. Then run the precompiler. It will subsitute your statements with the correct OCI-calls. <--edit--> If you don't know what DB you will use or you want to be able to change it very easy you can use ODBC. The hardest way: You can implement a generic Data-Access-Class in combination with a Wrapper-Class for each DB-API. So you just replace your wrapper class and you can use another DB. :-D -- karl
-
If you know what DB you will use and you know it won't change, you can use the API of your DB. I think most of the known DBs have at least a C Interface you can use. For Oracle look for OCI (Oracle Call Interface) in the Oracle-Docs (online at otn.oracle.com[^] ) <--edit--> Forgot to mention Pro*C/C++ Precompiler for Oracle. With this precompiler you can write your SQL-Statemetns simply into your C/C++ code. Then run the precompiler. It will subsitute your statements with the correct OCI-calls. <--edit--> If you don't know what DB you will use or you want to be able to change it very easy you can use ODBC. The hardest way: You can implement a generic Data-Access-Class in combination with a Wrapper-Class for each DB-API. So you just replace your wrapper class and you can use another DB. :-D -- karl
Thank you for your help, and for the link ! (and also for your suggestion about the hard-way....which I'll try to avoid !!!!) Jerome
-
Thanks for the quick answer ! I'm sure I'll find plenty of usefull informations in the links you provided. A question comes to my mind though...Is ODBC the only way to do it ? Or is it the easiest ? Does it exists on Linux ? Thanks again for your help ! Jerome