library: libRODBC
#include "TODBCServer.h"

TODBCServer


class description - header file - source file
viewCVS header - viewCVS source

class TODBCServer: public TSQLServer

Inheritance Inherited Members Includes Libraries
Class Charts

Function Members (Methods)

Display options:
Show inherited
Show non-public
public:
TODBCServer(const TODBCServer&)
TODBCServer(const char* db, const char* uid, const char* pw)
virtual~TODBCServer()
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 = "")
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() const
virtual TObject*TObject::DrawClone(Option_t* option = "") const
virtual Int_tDropDataBase(const char* dbname)
virtual voidTObject::Dump() const
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")
static TList*GetDataSources()
const char*TSQLServer::GetDB() const
const char*TSQLServer::GetDBMS() const
virtual Option_t*TObject::GetDrawOption() const
static TList*GetDrivers()
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_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() const
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTSQLServer::IsConnected() 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
virtual Bool_tIsSupportStatement() 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)
TODBCServer&operator=(const TODBCServer&)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTObject::Print(Option_t* option = "") const
static voidPrintDataSources()
static voidPrintDrivers()
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 = "") const
virtual voidTObject::SavePrimitive(ostream& 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 = "")
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 = 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")
private:
Bool_tEndTransaction(Bool_t commit)
Bool_tExtractErrors(short retcode, const char* method)
static TList*ListData(Bool_t isdrivers)

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::fTypetype of DBMS (MySQL, Oracle, SysBase, ...)
TStringTSQLServer::fHosthost to which we are connected
TStringTSQLServer::fDBcurrently selected DB
Int_tTSQLServer::fPortport to which we are connected
Int_tTSQLServer::fErrorCodeerror code of last operation
TStringTSQLServer::fErrorMsgerror message of last operation
Bool_tTSQLServer::fErrorOutenable error output
private:
void*fHenv
void*fHdbc
TStringfServerInfostring with DBMS name and version like MySQL 4.1.11 or Oracle 10.01.0030
TStringfUserId

Class Description

TODBCServer(const char *db, const char *uid, const char *pw)
 Open a connection to a ODBC server. The db arguments can be:
 1. Form "odbc://[user[:passwd]@]<host>[:<port>][/<database>][?Driver]",
    e.g.: "odbc://pcroot.cern.ch:3306/test?MySQL".
    Driver argument specifies ODBC driver, which should be used for
    connection. By default, MyODBC driver name is used.
    The uid is the username and pw the password that should be used
    for the connection.
    If uid and pw are not specified (==0), user and passwd arguments from
    URL will be used. Works only with MySQL ODBC, probably with PostrSQL
    ODBC.
 2. Form "odbcd://DRIVER={MyODBC};SERVER=pcroot.cern.ch;DATABASE=test;USER=user;PASSWORD=pass;OPTION=3;PORT=3306;"
    This is a form, which is accepted by SQLDriverConnect function of ODBC.
    Here some other arguments can be specified, which are not included
    in standard URL format.
 3. Form "odbcn://MySpecialConfig", where MySpecialConfig is entry,
    defined in user DSN (user data source). Here uid and pw should be
    always specified.

    Configuring unixODBC under Linux: http://www.unixodbc.org/odbcinst.html
    Remarks: for variants 1 & 2 it is enough to create/configure
    odbcinst.ini file. For variant 3 file odbc.ini should be created.
    Path to this files can be specified in enviromental variables like
      export ODBCINI=/home/my/unixODBC/etc/odbc.ini
      export ODBCSYSINI=/home/my/unixODBC/etc

    Configuring MySQL ODBC under Windows.
    Installing ODBC driver for MySQL is enough to use it under Windows.
    Afer odbcd:// variant can be used with DRIVER={MySQL ODBC 3.51 Driver};
    To configure User DSN, go into Start menu -> Settings ->
    Control panel -> Administrative tools-> Data Sources (ODBC).

    To install Oracle ODBC driver for Windows, one should download
    and install either complete Oracle client (~500 MB), or so-called
    Instant Client Basic and Instant Client ODBC (~20 MB together).
    Some remark about Instant Client:
       1) Two additional DLLs are required: mfc71.dll & msver71.dll
          They can be found either in MS VC++ 7.1 Free Toolkit or
          downloaded from other Internet sites
       2) ORACLE_HOME enviroment variable should be specified and point to
           location, where Instant Client files are extracted
       3) Run odbc_install.exe from account with administrative rights
       3) In $ORACLE_HOME/network/admin/ directory appropriate *.ora files
          like ldap.ora, sqlnet.ora, tnsnames.ora should be installed.
          Contact your Oracle administrator to get these files.
    After Oracle ODBC driver is installed, appropriate entry in ODBC drivers
    list like "Oracle in instantclient10_2" should appiar. Connection
    string example:
     "odbcd://DRIVER={Oracle in instantclient10_2};DBQ=db-test;UID=user_name;PWD=user_pass;";
~TODBCServer()
 Close connection to MySQL DB server.
TList* ListData(Bool_t isdrivers)
 Produce TList object with list of available 
 ODBC drivers (isdrivers = kTRUE) or data sources (isdrivers = kFALSE)
TList* GetDrivers()
 Produce TList object with list of available ODBC drivers
 User must delete TList object aftewards
 Name of driver can be used in connecting to data base in form
 TSQLServer::Connect("odbcd://DRIVER={<drivername>};DBQ=<dbname>;UID=user;PWD=pass;", 0, 0);
void PrintDrivers()
 Print list of ODBC drivers in form:
   <name> : <options list>
TList* GetDataSources()
 Produce TList object with list of available ODBC data sources
 User must delete TList object aftewards
 Name of data source can be used later for connection:
 TSQLServer::Connect("odbcn://<data_source_name>", "user", "pass");
void PrintDataSources()
 Print list of ODBC data sources in form:
   <name> : <options list>
Bool_t ExtractErrors(SQLRETURN retcode, const char* method)
 Extract errors, produced by last ODBC function call
void Close(Option_t *)
 Close connection to MySQL DB server.
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.
 The result object must be deleted by the user.
Bool_t Exec(const char* sql)
 Executes query which does not produce any results set
 Return kTRUE if successfull
Int_t SelectDataBase(const char *db)
 Select a database. Returns 0 if successful, non-zero otherwise.
 Not all RDBMS support selecting of database (catalog) after connecting
 Normally user should specify database name at time of connection
TSQLResult * GetDataBases(const char *)
 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.
TSQLResult * GetTables(const char*, const char* wild)
 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)
 Return list of tables in database
 See TSQLServer::GetTablesList() for details.
TSQLTableInfo* GetTableInfo(const char* tablename)
 Produces SQL table info
 Object must be deleted by user
TSQLResult * GetColumns(const char*, const char *table, const char*)
 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 GetMaxIdentifierLength()
 returns maximum allowed length of identifier (table name, column name, index name)
Int_t CreateDataBase(const char*)
 Create a database. Returns 0 if successful, non-zero otherwise.
Int_t DropDataBase(const char*)
 Drop (i.e. delete) a database. Returns 0 if successful, non-zero
 otherwise.
Int_t Reload()
 Reload permission tables. Returns 0 if successful, non-zero
 otherwise. User must have reload permissions.
Int_t Shutdown()
 Shutdown the database server. Returns 0 if successful, non-zero
 otherwise. User must have shutdown permissions.
const char * ServerInfo()
 Return server info.
TSQLStatement * Statement(const char *sql, Int_t bufsize)
 Creates ODBC statement for provided query.
 See TSQLStatement class for more details.
Bool_t StartTransaction()
 Starts transaction.
 Check for transaction support.
 Switch off autocommitment mode.
Bool_t EndTransaction(Bool_t commit)
 Complete current transaction (commit = kTRUE) or rollback
 Switches on autocommit mode of ODBC driver
Bool_t Commit()
 Commit transaction
Bool_t Rollback()
 Rollback transaction
TODBCServer(const char* db, const char *uid, const char *pw)
Bool_t IsSupportStatement()
{ return kTRUE; }

Author: Sergey Linev 6/02/2006
Last update: root/odbc:$Name: $:$Id: TODBCServer.cxx,v 1.14 2006/10/16 11:38:39 brun Exp $
Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. *


ROOT page - Class index - Class Hierarchy - Top of the page

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.