Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:51:45

0001 #include "CondTools/DQM/interface/ReadBase.h"
0002 #include "RelationalAccess/IRelationalDomain.h"
0003 #include "RelationalAccess/IConnection.h"
0004 #include "RelationalAccess/IConnectionServiceConfiguration.h"
0005 //#include "RelationalAccess/ISession.h"
0006 #include "RelationalAccess/ISessionProxy.h"
0007 #include "RelationalAccess/RelationalServiceException.h"
0008 //#include "CoralKernel/Context.h"
0009 #include <iostream>
0010 #include <cstdlib>
0011 
0012 ReadBase::ReadBase() : m_connectionService() {
0013   //coral::Context& context = coral::Context::instance();
0014   //context.loadComponent( "CORAL/RelationalPlugins/oracle" );
0015   //coral::IHandle<coral::IRelationalDomain> domain = context.query<coral::IRelationalDomain>( "CORAL/RelationalPlugins/oracle" );
0016   //if ( ! domain.isValid() )
0017   //  throw std::runtime_error( "Could not load the OracleAccess plugin" );
0018 }
0019 
0020 ReadBase::~ReadBase() {
0021   //if ( m_connection ) delete m_connection;
0022 }
0023 
0024 coral::ISessionProxy* ReadBase::connect(const std::string& connectionString,
0025                                         const std::string& user,
0026                                         const std::string& pass) {
0027   //coral::Context& ctx = coral::Context::instance();
0028   //coral::IHandle<coral::IRelationalDomain> iHandle=ctx.query<coral::IRelationalDomain>("CORAL/RelationalPlugins/oracle");
0029   //if ( ! iHandle.isValid() )
0030   //  throw std::runtime_error( "Could not load the OracleAccess plugin" );
0031   //
0032   //std::pair<std::string, std::string> connectionAndSchema = iHandle->decodeUserConnectionString( connectionString );
0033   //if ( ! m_connection )
0034   //  m_connection = iHandle->newConnection( connectionAndSchema.first );
0035 
0036   //if ( ! m_connection->isConnected() )
0037   //  m_connection->connect();
0038 
0039   //coral::ISession* session = m_connection->newSession( connectionAndSchema.second );
0040   //if ( session )
0041   //  session->startUserSession( user, pass );
0042   std::string userEnv("CORAL_AUTH_USER=" + user);
0043   std::string passEnv("CORAL_AUTH_PASSWORD=" + pass);
0044   ::putenv(const_cast<char*>(userEnv.c_str()));
0045   ::putenv(const_cast<char*>(passEnv.c_str()));
0046   m_connectionService.configuration().setAuthenticationService("CORAL/Services/EnvironmentAuthenticationService");
0047   return m_connectionService.connect(connectionString);
0048 }
0049 
0050 void ReadBase::setVerbosityLevel(coral::MsgLevel level) { coral::MessageStream::setMsgVerbosity(level); }