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 
13  m_connectionService() {
14  //coral::Context& context = coral::Context::instance();
15  //context.loadComponent( "CORAL/RelationalPlugins/oracle" );
16  //coral::IHandle<coral::IRelationalDomain> domain = context.query<coral::IRelationalDomain>( "CORAL/RelationalPlugins/oracle" );
17  //if ( ! domain.isValid() )
18  // throw std::runtime_error( "Could not load the OracleAccess plugin" );
19 }
20 
22  //if ( m_connection ) delete m_connection;
23 }
24 
25 coral::ISessionProxy*
26 ReadBase::connect( const std::string& connectionString,
27  const std::string& user,
28  const std::string& pass ) {
29  //coral::Context& ctx = coral::Context::instance();
30  //coral::IHandle<coral::IRelationalDomain> iHandle=ctx.query<coral::IRelationalDomain>("CORAL/RelationalPlugins/oracle");
31  //if ( ! iHandle.isValid() )
32  // throw std::runtime_error( "Could not load the OracleAccess plugin" );
33  //
34  //std::pair<std::string, std::string> connectionAndSchema = iHandle->decodeUserConnectionString( connectionString );
35  //if ( ! m_connection )
36  // m_connection = iHandle->newConnection( connectionAndSchema.first );
37 
38  //if ( ! m_connection->isConnected() )
39  // m_connection->connect();
40 
41  //coral::ISession* session = m_connection->newSession( connectionAndSchema.second );
42  //if ( session )
43  // session->startUserSession( user, pass );
44  std::string userEnv("CORAL_AUTH_USER="+user);
45  std::string passEnv("CORAL_AUTH_PASSWORD="+pass);
46  ::putenv( const_cast<char*>(userEnv.c_str()));
47  ::putenv( const_cast<char*>(passEnv.c_str()));
48  m_connectionService.configuration().setAuthenticationService("CORAL/Services/EnvironmentAuthenticationService");
49  return m_connectionService.connect( connectionString );
50 }
51 
52 void
53 ReadBase::setVerbosityLevel( coral::MsgLevel level ) {
54  coral::MessageStream::setMsgVerbosity(level);
55 }
coral::ConnectionService m_connectionService
Definition: ReadBase.h:34
virtual ~ReadBase()
Definition: ReadBase.cc:21
coral::ISessionProxy * connect(const std::string &connectionString, const std::string &user, const std::string &password)
Definition: ReadBase.cc:26
ReadBase()
Definition: ReadBase.cc:12
void setVerbosityLevel(coral::MsgLevel level)
Definition: ReadBase.cc:53