7 #include "RelationalAccess/AccessMode.h"
8 #include "RelationalAccess/IDatabaseServiceDescription.h"
9 #include "RelationalAccess/IDatabaseServiceSet.h"
10 #include "RelationalAccess/ILookupService.h"
11 #include "RelationalAccess/IAuthenticationService.h"
12 #include "RelationalAccess/IAuthenticationCredentials.h"
13 #include "RelationalAccess/ITypeConverter.h"
14 #include "RelationalAccess/IRelationalDomain.h"
15 #include "RelationalAccess/ConnectionService.h"
16 #include "RelationalAccess/IConnectionService.h"
17 #include "RelationalAccess/IConnectionServiceConfiguration.h"
19 #include "RelationalAccess/ISessionProxy.h"
24 #include "CoralKernel/Context.h"
25 #include "CoralBase/Exception.h"
27 #include <boost/algorithm/string/case_conv.hpp>
37 SessionMgr::SessionMgr() :
67 catch ( coral::Exception&
e ) {
78 if(m_connectionString!=
"")
82 m_connectionString = m_dbname;
83 }
else if(m_dbtype ==
"dblookup") {
84 m_connectionString = m_dbserver;
86 m_connectionString = m_dbtype +
"://" + m_dbserver +
"/" + m_dbname;
94 if( m_sessionproxy )
return *m_sessionproxy;
96 coral::ConnectionService connSvc;
97 coral::IConnectionServiceConfiguration& csc = connSvc.configuration();
98 csc.setConnectionRetrialPeriod( m_retrialPeriod );
99 csc.setConnectionRetrialTimeOut( m_retrialTimeout );
100 csc.setConnectionTimeOut( m_connectionTimeout );
103 if(csc.replicaSortingAlgorithm() ==
nullptr) {
106 csc.setReplicaSortingAlgorithm(*m_replicaSorter);
109 buildConnectionString();
111 m_sessionproxy = connSvc.connect(m_connectionString, coral::AccessMode::ReadOnly);
112 TRG_MSG_INFO(
"Opening session " << m_connectionString <<
" with " << m_retrialPeriod <<
"/" << m_retrialTimeout <<
"/" << m_connectionTimeout);
114 return *m_sessionproxy;
120 m_dbtype = boost::to_lower_copy(
s);
121 m_connectionString =
"";
127 m_connectionString =
"";
133 m_connectionString =
"";
139 m_connectionString =
"";
145 m_connectionString =
"";