3

I am using the ODAC components designed by the devart company with embarcadero C++ builder 10.2. Now I want to define an own class, which should be able to establish a connection to an oracle database. So I want to use the TOraSession component inside of my own class but without using the VCL.

The class is defined as written below:

#include "ora.hpp"
#include "Dbaccess.hpp"

class ConnectToDatabase
{
    public:

    ConnectToDatabase();
    virtual ~ConnectToDatabase();

    bool getConnected() const {return connected_;};
    void establishConnection();

    protected:

    TOraSession *OraSession;
    std::string server_;
    std::string username_;
    std::string password_;
    bool connected_;
    std::string port_;
    std::string sid_;
    std::string servername_;
};

My corresponding cpp-File looks like below:

#pragma link "DBAccess"

#include "connectToDatabase.h"

void ConnectToDatabase::establishConnection()
{
    OraSession = new TOraSession(NULL);
    OraSession->Options->Direct = True;
    OraSession->Server = server_.c_str();
    OraSession->Username = username_.c_str();
    OraSession->Password = password_.c_str();
    if (OraSession->Connected)
    {
        connected_ = true;
    }
    else
    {
        connected_ = false;
    } 
}

The problem is, that an error occurs while C++ builder tries to link my program.

Error-message:

'DATA.DBCONSTS.OBJ can't be opened'

So I hope, that someone has an idea, what is going wrong.

best regards Hoeh

Murmel
  • 5,402
  • 47
  • 53
Hoeh
  • 45
  • 4

0 Answers0