OnlineDB
EcalCondDB
src
EcalDBConnection.cc
Go to the documentation of this file.
1
#include <iostream>
2
#include <string>
3
#include <sstream>
4
#include <cstdlib>
5
#include <cstdlib>
6
#include <stdexcept>
7
#include "
OnlineDB/Oracle/interface/Oracle.h
"
8
9
using namespace
std
;
10
using namespace
oracle::occi
;
11
12
#include "
OnlineDB/EcalCondDB/interface/EcalDBConnection.h
"
13
#include "
OnlineDB/EcalCondDB/interface/DateHandler.h
"
14
15
EcalDBConnection::EcalDBConnection
(
string
host
,
string
sid,
string
user
,
string
pass,
int
port
) noexcept(
false
) {
16
stringstream
ss
;
17
try
{
18
ss
<<
"//"
<<
host
<<
":"
<<
port
<<
"/"
<< sid;
19
20
env
= Environment::createEnvironment(Environment::OBJECT);
21
conn
=
env
->createConnection(
user
, pass,
ss
.str());
22
stmt =
conn
->createStatement();
23
}
catch
(SQLException &
e
) {
24
cout
<<
ss
.str() << endl;
25
throw
(std::runtime_error(
"ERROR: Connection Failed: "
+
e
.getMessage()));
26
}
27
28
this->
host
=
host
;
29
this->sid = sid;
30
this->
user
=
user
;
31
this->pass = pass;
32
this->
port
=
port
;
33
}
34
35
EcalDBConnection::EcalDBConnection
(
string
sid,
string
user
,
string
pass) noexcept(
false
) {
36
try
{
37
env
= Environment::createEnvironment(Environment::OBJECT);
38
conn
=
env
->createConnection(
user
, pass, sid);
39
stmt =
conn
->createStatement();
40
}
catch
(SQLException &
e
) {
41
throw
(std::runtime_error(
"ERROR: Connection Failed: "
+
e
.getMessage()));
42
}
43
44
this->
host
=
""
;
45
this->sid = sid;
46
this->
user
=
user
;
47
this->pass = pass;
48
}
49
50
EcalDBConnection::~EcalDBConnection
() noexcept(
false
) {
51
//Close database conection and terminate environment
52
try
{
53
conn
->terminateStatement(stmt);
54
env
->terminateConnection(
conn
);
55
Environment::terminateEnvironment(
env
);
56
}
catch
(SQLException &
e
) {
57
throw
(std::runtime_error(
"ERROR: Destructor Failed: "
+
e
.getMessage()));
58
}
59
}
funct::false
false
Definition:
Factorize.h:29
gather_cfg.cout
cout
Definition:
gather_cfg.py:144
SiStripCommissioningClient_cfg.conn
conn
Definition:
SiStripCommissioningClient_cfg.py:5
EcalDBConnection::EcalDBConnection
EcalDBConnection(std::string host, std::string sid, std::string user, std::string pass, int port=1521) noexcept(false)
query.host
string host
Definition:
query.py:115
contentValuesCheck.ss
ss
Definition:
contentValuesCheck.py:33
oracle::occi
Definition:
ConnectionManager.h:7
EcalDBConnection::~EcalDBConnection
virtual ~EcalDBConnection() noexcept(false)
Definition:
EcalDBConnection.cc:50
web.browse_db.env
env
Definition:
browse_db.py:18
query.port
int port
Definition:
query.py:116
EcalDBConnection.h
EnviromentSettings.user
user
Definition:
EnviromentSettings.py:30
std
Definition:
JetResolutionObject.h:76
Oracle.h
DateHandler.h
MillePedeFileConverter_cfg.e
e
Definition:
MillePedeFileConverter_cfg.py:37
Generated for CMSSW Reference Manual by
1.8.16