1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Connect C++ with Oracle

Discussion in 'C++' started by Shishir191, Jul 24, 2007.

  1. Shishir191

    Shishir191 New Member

    Joined:
    Jul 24, 2007
    Messages:
    27
    Likes Received:
    1
    Trophy Points:
    0
    Occupation:
    Software Engineer
    Location:
    Delhi
    Thanks to all
     
  2. ZeroMaru

    ZeroMaru New Member

    Joined:
    Aug 28, 2008
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    I tried compiling this with:

    devc++
    miscrosoft visual studio 2003 (vc++ 7)
    microsoft visual studio 2005 (8)
    microsoft visual studio 2008 (9)

    i dont know if im doing somthing wrong or what, but i keep getting this errors:
    ^
    Code:
    d:\rcocchiararo\Mis documentos\Visual Studio Projects\test\test.cpp(31) : error C2065: 'DbManager' : identificador no declarado
    d:\rcocchiararo\Mis documentos\Visual Studio Projects\test\test.cpp(31) : error C2065: 'dbm' : identificador no declarado
    d:\rcocchiararo\Mis documentos\Visual Studio Projects\test\test.cpp(33) : error C2065: 'OracleServices' : identificador no declarado
    d:\rcocchiararo\Mis documentos\Visual Studio Projects\test\test.cpp(33) : error C2065: 'oras' : identificador no declarado
    d:\rcocchiararo\Mis documentos\Visual Studio Projects\test\test.cpp(44) : error C2061: error de sintaxis : identificador 'DbManager'
    d:\rcocchiararo\Mis documentos\Visual Studio Projects\test\test.cpp(44) : error C3861: 'dbm': no se encontró el identificador, ni siquiera con búsqueda dependiente de argumentos
    d:\rcocchiararo\Mis documentos\Visual Studio Projects\test\test.cpp(46) : error C2227: el operando izquierdo de '->getOracleServices' debe señalar a class/struct/union
            el tipo es ''unknown-type''
    d:\rcocchiararo\Mis documentos\Visual Studio Projects\test\test.cpp(46) : error C3861: 'oras': no se encontró el identificador, ni siquiera con búsqueda dependiente de argumentos
    d:\rcocchiararo\Mis documentos\Visual Studio Projects\test\test.cpp(46) : error C3861: 'dbm': no se encontró el identificador, ni siquiera con búsqueda dependiente de argumentos
    d:\rcocchiararo\Mis documentos\Visual Studio Projects\test\test.cpp(50) : error C2227: el operando izquierdo de '->connection' debe señalar a class/struct/union
            el tipo es ''unknown-type''
    d:\rcocchiararo\Mis documentos\Visual Studio Projects\test\test.cpp(50) : error C3861: 'oras': no se encontró el identificador, ni siquiera con búsqueda dependiente de argumentos
    d:\rcocchiararo\Mis documentos\Visual Studio Projects\test\test.cpp(109) : error C2541: 'delete' : no se pueden eliminar objetos que no sean punteros
    d:\rcocchiararo\Mis documentos\Visual Studio Projects\test\test.cpp(109) : error C3861: 'dbm': no se encontró el identificador, ni siquiera con búsqueda dependiente de argumentos
    d:\rcocchiararo\Mis documentos\Visual Studio Projects\test\test.cpp(114) : error C3861: 'dbm': no se encontró el identificador, ni siquiera con búsqueda dependiente de argumentos
    d:\rcocchiararo\Mis documentos\Visual Studio Projects\test\test.cpp(116) : error C2227: el operando izquierdo de '->rollbackActions' debe señalar a class/struct/union
            el tipo es ''unknown-type''
    d:\rcocchiararo\Mis documentos\Visual Studio Projects\test\test.cpp(116) : error C3861: 'dbm': no se encontró el identificador, ni siquiera con búsqueda dependiente de argumentos
    d:\rcocchiararo\Mis documentos\Visual Studio Projects\test\test.cpp(119) : error C2061: error de sintaxis : identificador 'ExoException'
    d:\rcocchiararo\Mis documentos\Visual Studio Projects\test\test.cpp(119) : error C2310: los controladores de tipo catch deben especificar un tipo
    d:\rcocchiararo\Mis documentos\Visual Studio Projects\test\test.cpp(121) : error C2065: 'ex1' : identificador no declarado
    d:\rcocchiararo\Mis documentos\Visual Studio Projects\test\test.cpp(121) : error C2228: el operando izquierdo de '.getExceptionText' debe tener el tipo class/struct/union
            el tipo es ''unknown-type''
    
    is dbmanager.h or some other library responsable for defining all those variables/things ?

    i have tried with oracle client and oracle server 10g installed.
    I downloaded occi for visual studio 2005 (vs8), and well, i dont know what else to do :(
     
  3. ZeroMaru

    ZeroMaru New Member

    Joined:
    Aug 28, 2008
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    to bad i see no edit button, anyway, i forgot to mention that im new to visual studio, so i may be missing some configuration or chosing the wrong type of project, dunno :(
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,276
    Likes Received:
    364
    Trophy Points:
    83
    It will come when you reach a double digit post count.
     
  5. ZeroMaru

    ZeroMaru New Member

    Joined:
    Aug 28, 2008
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    i see

    (i was kinda exited about a posible solution for my "problem" when i saw i had a mail from this forum :p )
     
  6. ZeroMaru

    ZeroMaru New Member

    Joined:
    Aug 28, 2008
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    ahhhhhhh heck

    the moment i finished posting the last mesage i saw i had a reply on another forum telling me this about my problem:

    any ideas about that either ? i find it strange that this example is all over the web and im the only one unable to compile it.
     
  7. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    You're not the only one unable to compile it. The code is dependent on dbmanager.h and won't build without it, and dbmanager.h (and any library or other source code it relates to) is not referenced anywhere. Simply removing #include <dbmanager.h> WON'T solve the problem because there are references within the code, i.e.:
    Code:
    DbManager* dbm = NULL;
    dbm = new DbManager(userName);
    oras = dbm->getOracleServices();
    Connection * conn = oras->connection();
    delete dbm;
    dbm->rollbackActions(ex, stmt, resultSet);
    
    OP: how about providing dbmanager.h and dbmanager.cpp, or at least stating where it can be found, so that people can actually use this example?
     
  8. imrose_suleman

    imrose_suleman New Member

    Joined:
    Oct 18, 2008
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Programer in Tata consultancy services
    Location:
    native of hyderabad presently in chennai
    created an employee table in sql and coded in cpp....i compiled using g++ compiler...but getting lot of errors ....can u pls help me out..
     
  9. imrose_suleman

    imrose_suleman New Member

    Joined:
    Oct 18, 2008
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Programer in Tata consultancy services
    Location:
    native of hyderabad presently in chennai
    there is no clear solution to this problem..still unable to fix this prob in comp....
    i need to do case study..and i need it urgently...
     
  10. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    I'm trying to fix the code but I keep getting unexplained crashes.
    In the meantime use some of the OCCI demo programs from $ORACLE_HOME/rdbms/demo. In 10g these are installed from the Companion disk.
     
  11. Mclarry

    Mclarry New Member

    Joined:
    Oct 19, 2008
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    What is connect c++ with oracle used for? Pls explain cos im a starter hacker.
     
  12. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,276
    Likes Received:
    364
    Trophy Points:
    83
    If you are not sure what is C++ and oracle then you should post your query in the new thread and not just jump into any thread saying you are new to hacking. This thread is also not about hacking BTW
     
  13. gandu

    gandu New Member

    Joined:
    Sep 10, 2008
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    Hi,

    Its really very good

    Thanks
     
  14. happyz

    happyz New Member

    Joined:
    Nov 18, 2008
    Messages:
    26
    Likes Received:
    0
    Trophy Points:
    0
    Gud and will give it a try
     
  15. prabhat1

    prabhat1 New Member

    Joined:
    Mar 21, 2008
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    0
    Hi..Shishir ...very Nice code .....But I need C++ connectivity with DB2 can u suggest some code as well as configuration requirements for connecting C++ with DB2......

    thanks in advance.............
     
  16. hkp819

    hkp819 New Member

    Joined:
    Dec 4, 2008
    Messages:
    59
    Likes Received:
    1
    Trophy Points:
    0
    great. It is great program. I confused to understand it. Because i am not good in programming. But it is not too much complex.
    thanks
     
  17. skp819

    skp819 New Member

    Joined:
    Dec 8, 2008
    Messages:
    89
    Likes Received:
    3
    Trophy Points:
    0
    thank for share it. It is helpful for me.
    thanks once again.
     
  18. vishy_acts

    vishy_acts New Member

    Joined:
    Apr 23, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi
    This code is not working on Unix Solaris .
    Its giving error Could not open include file<DbManager.h>
    what is the solution ?
     
  19. trentven

    trentven New Member

    Joined:
    Mar 13, 2012
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Hi,

    Am trying to connect with this piece of code from Dev C++ 4.9.9.2. I believe that Dev C++ is using GCC compiler....

    Compilation is success.

    But the problem is when i try to execute the code am getting "Linker" error.

    Any Idea about how resolve the above error.... Please advice....

    With Regards,
    Venkat Raghaven
     
  20. trentven

    trentven New Member

    Joined:
    Mar 13, 2012
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    I even tried with the "OCI examples" but no go....

    Still the same "Linker" error....

    Am really Stuck with this..... Please help....

    With Regards,
    Venkat Raghaven
     

Share This Page