CMS 3D CMS Logo

ReadBase.cc
Go to the documentation of this file.
2 #include "RelationalAccess/IRelationalDomain.h"
3 #include "RelationalAccess/IConnection.h"
4 #include "RelationalAccess/IConnectionServiceConfiguration.h"
5 //#include "RelationalAccess/ISession.h"
6 #include "RelationalAccess/ISessionProxy.h"
7 #include "RelationalAccess/RelationalServiceException.h"
8 //#include "CoralKernel/Context.h"
9 #include <iostream>
10 #include <cstdlib>
11 
12 ReadBase::ReadBase() : m_connectionService() {
13  //coral::Context& context = coral::Context::instance();
14  //context.loadComponent( "CORAL/RelationalPlugins/oracle" );
15  //coral::IHandle<coral::IRelationalDomain> domain = context.query<coral::IRelationalDomain>( "CORAL/RelationalPlugins/oracle" );
16  //if ( ! domain.isValid() )
17  // throw std::runtime_error( "Could not load the OracleAccess plugin" );
18 }
19 
21  //if ( m_connection ) delete m_connection;
22 }
23 
24 coral::ISessionProxy* ReadBase::connect(const std::string& connectionString,
25  const std::string& user,
26  const std::string& pass) {
27  //coral::Context& ctx = coral::Context::instance();
28  //coral::IHandle<coral::IRelationalDomain> iHandle=ctx.query<coral::IRelationalDomain>("CORAL/RelationalPlugins/oracle");
29  //if ( ! iHandle.isValid() )
30  // throw std::runtime_error( "Could not load the OracleAccess plugin" );
31  //
32  //std::pair<std::string, std::string> connectionAndSchema = iHandle->decodeUserConnectionString( connectionString );
33  //if ( ! m_connection )
34  // m_connection = iHandle->newConnection( connectionAndSchema.first );
35 
36  //if ( ! m_connection->isConnected() )
37  // m_connection->connect();
38 
39  //coral::ISession* session = m_connection->newSession( connectionAndSchema.second );
40  //if ( session )
41  // session->startUserSession( user, pass );
42  std::string userEnv("CORAL_AUTH_USER=" + user);
43  std::string passEnv("CORAL_AUTH_PASSWORD=" + pass);
44  ::putenv(const_cast<char*>(userEnv.c_str()));
45  ::putenv(const_cast<char*>(passEnv.c_str()));
46  m_connectionService.configuration().setAuthenticationService("CORAL/Services/EnvironmentAuthenticationService");
47  return m_connectionService.connect(connectionString);
48 }
49 
50 void ReadBase::setVerbosityLevel(coral::MsgLevel level) { coral::MessageStream::setMsgVerbosity(level); }
personalPlayback.level
level
Definition: personalPlayback.py:22
ReadBase::setVerbosityLevel
void setVerbosityLevel(coral::MsgLevel level)
Definition: ReadBase.cc:50
ReadBase.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ReadBase::~ReadBase
virtual ~ReadBase()
Definition: ReadBase.cc:20
EnviromentSettings.user
user
Definition: EnviromentSettings.py:30
ReadBase::ReadBase
ReadBase()
Definition: ReadBase.cc:12
ReadBase::connect
coral::ISessionProxy * connect(const std::string &connectionString, const std::string &user, const std::string &password)
Definition: ReadBase.cc:24
l1RCTOmdsFedVectorProducer_cfi.connectionString
connectionString
Definition: l1RCTOmdsFedVectorProducer_cfi.py:4
ReadBase::m_connectionService
coral::ConnectionService m_connectionService
Definition: ReadBase.h:36