In het onderstaande voorbeeld maak ik gebruik van OCCI om een verbinding op te zetten met Oracle. Daarna execute ik twee keer dezelfde query. Echter het probleem is dat het statement gecached zou moeten worden, wat dus niet gebeurd en ik kan maar niet vinden waarom.
Dingen die ik al geprobeerd heb:
1. Regels 29/30 in commentaar.
2. Zowel met connectionpool als zonder geprobeerd.
3. Deze documentatie toegepast: (http://download.oracle.co...8/relational.htm#sthref87 hoofdstuk 2-7).
4. Veel googlen maar ook niets kunnen vinden
Ik hoop dat iemand van jullie een idee heeft.
Wat ik ook doe uitvoer:
Dingen die ik al geprobeerd heb:
1. Regels 29/30 in commentaar.
2. Zowel met connectionpool als zonder geprobeerd.
3. Deze documentatie toegepast: (http://download.oracle.co...8/relational.htm#sthref87 hoofdstuk 2-7).
4. Veel googlen maar ook niets kunnen vinden
Ik hoop dat iemand van jullie een idee heeft.
Wat ik ook doe uitvoer:
code:
1
2
| Cached: 0 Cached: 0 |
C++:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
| #include <cstdlib> #include <string> #include <sstream> #include <occi.h> #include <iostream> #define USER "test" #define PASS "test" #define SID "test-db" using namespace std; int main(int argc, char** argv) { oracle::occi::Environment* environment = oracle::occi::Environment::createEnvironment(oracle::occi::Environment::THREADED_MUTEXED); oracle::occi::ConnectionPool* conpool = environment->createConnectionPool(USER,PASS, SID, 1, 5, 1); conpool->setStmtCacheSize(200); string sql = "select * from locaties"; string tag = "testtag"; oracle::occi::Connection* connection = conpool->createConnection(USER, PASS); oracle::occi::Statement* stmt = connection->createStatement(sql, tag); cout << "Cached: " << connection->isCached(sql, tag) << endl; stmt->execute(); connection->terminateStatement(stmt, tag); conpool->terminateConnection(connection); connection = conpool->createConnection(USER, PASS); stmt = connection->createStatement(sql, tag); cout << "Cached: " << connection->isCached(sql, tag) << endl; stmt->execute(); connection->terminateStatement(stmt, tag); conpool->terminateConnection(connection); return 0; } |