Solved

DOA & BCB6

Posted on 2004-04-15
4
964 Views
Last Modified: 2013-11-17
Hello experts!

How can i`m emulate dinamicaly, for example, 100 user connections to Oracle DB using DOA?

Best regards.
Dmitry.
0
Comment
Question by:GDE
  • 2
4 Comments
 
LVL 9

Expert Comment

by:Cayce
ID: 10843974
1) get the Delphi Direct ORACLE Access Components from: http://sourceforge.net/projects/delphioci/
2) create a new package in BCB6, put every .pas file found on the "src" folder of the delphioci project
3) add the DesignIntf.pas file to the package (it's fund under $(BCB)/Source/ToolsAPI)
4) build and install the package. This will give you the new following components:
  TAMemoryDataset, TAOraSQL, TAOraUpdateSQL, TMemoryDataset, TOraDB, TOraSQL
  they will all be under the "Data Access" toolbar
5) documentation for all these components is found on the "doc" folder of the delphioci package
6) Now you just need to create an application that makes about 20 threads, each with it's own connection, running a serie of transactions against the oracle database (and harvesting performance data on the way), then distribute your resulting application into several computers (5 or so), and run them all at once.

There you go, a DOA client load simulator.

Good Luck!
0
 
LVL 2

Author Comment

by:GDE
ID: 10856427
I`m have DOA v.3.4.6.1 installed on my computer.
Can i`m dynamically create oracle session (TOralceSession)?
have you any example?

tnx.
Dmitry
0
 
LVL 9

Accepted Solution

by:
Cayce earned 500 total points
ID: 11034604
Are you using the DOA components from allroundautomations ? (It looks like to me)

Please let me know so I relate to the proper documentation.

I like the Delphi DOA components from SourceForge (due their open source nature), and I've never used the allroundautomation ones (which look ok! and they are cheap too).

The current version of the DOA I could find is 4.05. As far as I could look into the documentation you can create multiple instances of a TOracleSession.
From DOA 4.05 documentation:
"You use the TOracleSession component to connect to an Oracle database and to control transactions. You can use many sessions simultaneously, accessing different databases."

There's plenty of examples and documentation on these components in this package: http://www.allroundautomations.nl/doac6.exe.

What I would suggest doing (if you're using these components) is:
1) Create a thread that starts up it's own TOracleSession that runs transactions against the database. Logon to the database. Create a TOracleQuery component and then assign the Session property, now execute Querys until the thread is asked to stop.

Something like this:

#include <Oracle.hpp>

class MyThread : public TThread {
private:
  TOracleSession* Session;
  TOracleQuery* Query;
public:
  __fastcall MyThread(TComponent* Owner) {
    Session = new TOracleSession(Owner);
    Query = new TOracleQuery(Owner);
  }
  void __fastcall ~MyThread() {
    delete Query;
    delete Session;
  }
  void __fastcall Startup() {
    Session->LogonUsername = "DBA";
    Session->LogonPassword = "DBA";
    Session->LogonDatabase = "PerformanceTest";
    Session->Pooling = spNone;
    try {
      Session->LogOn();
    } catch(EOracleError &e) {
      // do something
    }
    Query->Session = Session;
  }
  void __fastcall Cleanup() {
    Query->Close();
    Session->LogOff();
  }
  void __fastcall RunQuery() {
    static int QueryIndex = 0;
    static const int    NumQueries = 3;
    // these files contain the SQL statement
    static const String Queries[NumQueries] = { "query1.sql", "query2.sql", "query3.sql" };
    if(Session->Connected) {
      if(QueryIndex == NumQueries)
        QueryIndex = 0;
      Query->SQL->LoadFromFile(Queries[QueryIndex++]);
      // if the query has some variables, modify the Variable property
      Query->Execute();
      // do something with the query data (if query is a SELECT statement)
    }
  }
  void __fastcall Execute() {
    Startup();
    while(!Terminated)  {
      RunQuery();
    }
    Cleanup();
  }
};
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now