library: libRODBC
#include "TODBCServer.h"

TODBCServer


class description - header file - source file - inheritance tree (.pdf)

class TODBCServer : public TSQLServer

Inheritance Chart:
TObject
<-
TSQLServer
<-
TODBCServer
    private:
Bool_t EndTransaction(Bool_t commit) Bool_t ExtractErrors(short retcode, const char* method) public:
TODBCServer(const char* db, const char* uid, const char* pw) TODBCServer(const TODBCServer&) virtual ~TODBCServer() static TClass* Class() virtual void Close(Option_t* opt = "") virtual Bool_t Commit() virtual Int_t CreateDataBase(const char* dbname) virtual Int_t DropDataBase(const char* dbname) virtual Bool_t Exec(const char* sql) virtual TSQLResult* GetColumns(const char* dbname, const char* table, const char* wild = "0") virtual TSQLResult* GetDataBases(const char* wild = "0") virtual Int_t GetMaxIdentifierLength() virtual TSQLTableInfo* GetTableInfo(const char* tablename) virtual TSQLResult* GetTables(const char* dbname, const char* wild = "0") virtual TList* GetTablesList(const char* wild = "0") virtual TClass* IsA() const virtual Bool_t IsSupportStatement() const TODBCServer& operator=(const TODBCServer&) virtual TSQLResult* Query(const char* sql) virtual Int_t Reload() virtual Bool_t Rollback() virtual Int_t SelectDataBase(const char* dbname) virtual const char* ServerInfo() virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual Int_t Shutdown() virtual Bool_t StartTransaction() virtual TSQLStatement* Statement(const char* sql, Int_t = 100) virtual void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b)

Data Members

    private:
void* fHenv void* fHdbc TString fInfo

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.
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 *)
 Select a database. Returns 0 if successful, non-zero otherwise.
 Does not implemented for ODBC driver. 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()

Author: Sergey Linev 6/02/2006
Last update: root/odbc:$Name: $:$Id: TODBCServer.cxx,v 1.12 2006/06/25 18:43:24 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.