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;";
Bool_t ExtractErrors(SQLRETURN retcode, const char* method)
Extract errors, produced by last ODBC function call
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.
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 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.
TODBCServer(const char* db, const char *uid, const char *pw)
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.