Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Intefacing a database with ANSI C++

Intefacing a database with ANSI C++

Scheduled Pinned Locked Moved C / C++ / MFC
c++databaseoraclelinux
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jerome Conus
    wrote on last edited by
    #1

    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

    M K 2 Replies Last reply
    0
    • J Jerome Conus

      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

      M Offline
      M Offline
      markkuk
      wrote on last edited by
      #2

      The following class libraries may help:

      • Database Template Library
      • ODBC++
      • freeodbc++
      J 1 Reply Last reply
      0
      • M markkuk

        The following class libraries may help:

        • Database Template Library
        • ODBC++
        • freeodbc++
        J Offline
        J Offline
        Jerome Conus
        wrote on last edited by
        #3

        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

        M 1 Reply Last reply
        0
        • J Jerome Conus

          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

          K Offline
          K Offline
          karl_w
          wrote on last edited by
          #4

          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

          J 1 Reply Last reply
          0
          • K karl_w

            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

            J Offline
            J Offline
            Jerome Conus
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            • J Jerome Conus

              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

              M Offline
              M Offline
              markkuk
              wrote on last edited by
              #6

              ODBC is the most portable way, it exists in Linux/Unix and you can write database-independent code with it (with some effort).

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups