class TOracleServer: public TSQLServer


TOracleServer

This class implements an OCCI interface to Oracle data bases.
It uses the instantclient10 software available from Oracle.
To install this client software do:
1) Download Instant Client Packages (4 files) from:
     http://www.oracle.com/technology/software/tech/oci/instantclient/index.html
2) Unzip the files into instantclient10_1 (Mac OS X example here):
unzip instantclient-basic-macosx-10.1.0.3.zip
unzip instantclient-sqlplus-macosx-10.1.0.3.zip
unzip instantclient-sdk-macosx-10.1.0.3.zip
unzip instantclient-jdbc-macosx-10.1.0.3.zip
3) Create two symbolic links for the files that have the version
appended:
ln -s libclntsh.dylib.10.1 libclntsh.dylib
ln -s libocci.dylib.10.1 libocci.dylib
4) Add instantclient10_1 directory to your (DY)LD_LIBRARY_PATH
in your .profile:
export DYLD_LIBRARY_PATH="<pathto>/instantclient10_1"
Use DY only on Mac OS X.
5) If you also want to use the sqlplus command line app add also
export SQLPATH="<pathto>/instantclient10_1"
6) If you want to connect to a remote db server you will also need
to create a tnsname.ora file which describes the local_name for
the remote db servers (at CERN most public machines have this
file in /etc). If it is not in /etc create TNS_ADMIN:
export TNS_ADMIN="<path-to-dir-containing-tnsname.ora>"
7) Test it our with the sqlplus command line app:
sqlplus [username][/password]@<local_name>
or
sqlplus [username][/password]@//[hostname][:port][/database]

ATTENTION: This plugin will not work on Mac OS X / Intel as Oracle
has no intention to release a universal binary of the instantclient
libraries.


Function Members (Methods)

public:
TOracleServer(const TOracleServer&)
TOracleServer(const char* db, const char* uid, const char* pw)
virtual~TOracleServer()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTObject::Clear(Option_t* = "")
virtual TObject*TObject::Clone(const char* newname = "") const
virtual voidClose(Option_t* opt = "")
virtual Bool_tCommit()
virtual Int_tTObject::Compare(const TObject* obj) const
static TSQLServer*TSQLServer::Connect(const char* db, const char* uid, const char* pw)
virtual voidTObject::Copy(TObject& object) const
virtual Int_tCreateDataBase(const char* dbname)
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual Int_tDropDataBase(const char* dbname)
virtual voidTObject::Dump() constMENU
virtual voidTSQLServer::EnableErrorOutput(Bool_t on = kTRUE)
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual Bool_tExec(const char* sql)
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
virtual TSQLResult*GetColumns(const char* dbname, const char* table, const char* wild = 0)
virtual TSQLResult*GetDataBases(const char* wild = 0)
const char*TSQLServer::GetDB() const
const char*TSQLServer::GetDBMS() const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual Int_tTSQLServer::GetErrorCode() const
virtual const char*TSQLServer::GetErrorMsg() const
const char*TSQLServer::GetHost() const
virtual const char*TObject::GetIconName() const
virtual Int_tGetMaxIdentifierLength()
virtual const char*TObject::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
Int_tTSQLServer::GetPort() const
virtual TSQLTableInfo*GetTableInfo(const char* tablename)
virtual TSQLResult*GetTables(const char* dbname, const char* wild = 0)
virtual TList*GetTablesList(const char* wild = 0)
virtual const char*TObject::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTObject::Hash() const
virtual Bool_tHasStatement() const
virtual Bool_tTSQLServer::HasTable(const char* tablename)
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tIsConnected() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTSQLServer::IsError() const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTObject::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTObject::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TOracleServer&operator=(const TOracleServer&)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTObject::Print(Option_t* option = "") const
virtual TSQLResult*Query(const char* sql)
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
virtual Int_tReload()
voidTObject::ResetBit(UInt_t f)
virtual Bool_tRollback()
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(basic_ostream<char,char_traits<char> >& out, Option_t* option = "")
virtual Int_tSelectDataBase(const char* dbname)
virtual const char*ServerInfo()
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual Int_tShutdown()
virtual Bool_tStartTransaction()
virtual TSQLStatement*Statement(const char* sql, Int_t niter = 100)
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
voidTSQLServer::ClearError()
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()
voidTSQLServer::SetError(Int_t code, const char* msg, const char* method = 0)

Data Members

public:
enum TSQLServer::ESQLDataTypes { kSQL_NONE
kSQL_CHAR
kSQL_VARCHAR
kSQL_INTEGER
kSQL_FLOAT
kSQL_DOUBLE
kSQL_NUMERIC
kSQL_BINARY
kSQL_TIMESTAMP
};
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
protected:
TStringTSQLServer::fDBcurrently selected DB
Int_tTSQLServer::fErrorCodeerror code of last operation
TStringTSQLServer::fErrorMsgerror message of last operation
Bool_tTSQLServer::fErrorOutenable error output
TStringTSQLServer::fHosthost to which we are connected
Int_tTSQLServer::fPortport to which we are connected
TStringTSQLServer::fTypetype of DBMS (MySQL, Oracle, SysBase, ...)
private:
Connection*fConnconnection to Oracle server
Environment*fEnvenvironment of Oracle access
TStringfInfoinfo string with Oracle version information

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TOracleServer(const char* db, const char* uid, const char* pw)
 Open a connection to a Oracle DB server. The db arguments should be
 of the form "oracle://connection_identifier[/<database>]", e.g.:
 "oracle://cmscald.fnal.gov/test". The uid is the username and pw
 the password that should be used for the connection.
~TOracleServer()
 Close connection to Oracle DB server.
void Close(Option_t* opt = "")
 Close connection to Oracle DB server.
TSQLStatement * Statement(const char* sql, Int_t niter = 100)
TSQLResult * Query(const char* sql)
 Execute SQL command. Result object must be deleted by the user.
 Returns a pointer to a TSQLResult object if successful, 0 otherwise.
Bool_t Exec(const char* sql)
 Execute sql command wich does not produce any result set.
 Return kTRUE if succesfull
TSQLResult * GetTables(const char* dbname, const char* wild = 0)
 List all tables in the specified database. Wild is for wildcarding
 "t%" list all tables starting with "t".
 Returns a pointer to a TSQLResult object if successful, 0 otherwise.
 The result object must be deleted by the user.
TList* GetTablesList(const char* wild = 0)
TSQLTableInfo * GetTableInfo(const char* tablename)
 Produces SQL table info
 Object must be deleted by user
TSQLResult * GetColumns(const char* dbname, const char* table, const char* wild = 0)
 List all columns in specified table in the specified database.
 Wild is for wildcarding "t%" list all columns starting with "t".
 Returns a pointer to a TSQLResult object if successful, 0 otherwise.
 The result object must be deleted by the user.
Int_t SelectDataBase(const char* dbname)
 Select a database. Returns 0 if successful, non-zero otherwise.
 NOT IMPLEMENTED.
TSQLResult * GetDataBases(const char* wild = 0)
 List all available databases. Wild is for wildcarding "t%" list all
 databases starting with "t".
 Returns a pointer to a TSQLResult object if successful, 0 otherwise.
 The result object must be deleted by the user.
 NOT IMPLEMENTED.
Int_t CreateDataBase(const char* dbname)
 Create a database. Returns 0 if successful, non-zero otherwise.
 NOT IMPLEMENTED.
Int_t DropDataBase(const char* dbname)
 Drop (i.e. delete) a database. Returns 0 if successful, non-zero
 otherwise.
 NOT IMPLEMENTED.
Int_t Reload()
 Reload permission tables. Returns 0 if successful, non-zero
 otherwise. User must have reload permissions.
 NOT IMPLEMENTED.
Int_t Shutdown()
 Shutdown the database server. Returns 0 if successful, non-zero
 otherwise. User must have shutdown permissions.
 NOT IMPLEMENTED.
const char * ServerInfo()
 Return Oracle server version info.
Bool_t StartTransaction()
 Call Commit() to submit all chanes, done before.
 Commit() ot Rollback() must be used to complete submitted actions or cancel them
Bool_t Commit()
 Commits all changes made since the previous Commit() or Rollback()
 Return kTRUE if OK
Bool_t Rollback()
 Drops all changes made since the previous Commit() or Rollback()
 Return kTRUE if OK
TOracleServer(const char* db, const char* uid, const char* pw)
Bool_t IsConnected()
{ return (fConn!=0) && (fEnv!=0); }
Bool_t HasStatement()
{ return kTRUE; }
Int_t GetMaxIdentifierLength()
{ return 30; }

Author: Yan Liu and Shaowen Wang 23/11/04
Last change: root/physics:$Id: TOracleServer.h 23102 2008-04-09 22:18:41Z pcanal $
Last generated: 2008-06-25 08:50
Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.