2 Replies Latest reply on Mar 27, 2012 1:58 AM by 926197

    Oracle11 XE and ODP / ODBC

      I have Oracle 11 XE installed and I wish to configure ODBC (Or any method to allow Visual Studio 8 , and C++ to access the Oracle database)

      I tried downloading and installing the ODT ( file: ODTwithODAC112030 ) but the ORACLE_HOME quoted was not the Oracle11 XE ORACLE_HOME.

      I checked for previous installed oracle products, but the installer claimed it could not find any installed oracle products. But Oracle XE is working fine.

      Any suggestions on how to proceed are welcome.


        • 1. Re: Oracle11 XE and ODP / ODBC
          gdarling - oracle
          The 11g XE home should already come with ODBC and ODP.NET; there should be no need to add another home.

          The exception to that would be if you wanted to use Oracle Developer Tools for Visual Studio plugin for Server Explorer, in which case you'd need to go ahead and add a ODTwithODAC112030 install into a separate home. After doing that, you'd need to setup tnsnames.ora in that new home so the client can find the XE database.

          Hope it helps,
          • 2. Re: Oracle11 XE and ODP / ODBC
            Thanks, I have the ODBC connection working, in the sense of being able to test the connection via SQL> connect system/password

            but, I need to run SQL commands from a C++ program against the Oracle 11 XE database, so what i need is C++ code examples along the following lines:

            1. Include the Header Files
            # include statements at the beginning of your programs:
            #include <sql.h>

            2. Open a Connection to a Database
            Set the environment handle:
            SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &hdlEnv);

            Set ODBC Driver version:

            Set the connection handle:
            SQLAllocHandle(SQL_HANDLE_DBC, hdlEnv, &hdlConn);

            Connect to the database:
            SQLConnect(hdlConn, (SQLCHAR*)dsnName,SQL_NTS,(SQLCHAR*)userID,SQL_NTS, (SQLCHAR*)passwd, SQL_NTS);

            Plus an example of assembling the SQL command for dispatch to Oracle via ODBC and accessing the reply (if any)

            I have looked in the documentation but have found nothing ...

            So i would appreciate being pointed in the right dirrection.