data access with linux
TRANSCRIPT
Data Access with LinuxData Access with Linux
GNOMEODBC
Bon
obo libgda
Copyright StatementCopyright Statement
© 2001 Adam Tauno Williams ([email protected])
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. You may obtain a copy of the GNU Free Documentation License from the Free Software Foundation by visiting their Web site or by writing to: Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
CreditsCredits
The assistance of the following people was imperative to the completionof the presentation:
Nick Gorham of the unixODBC projectRodr igo Moya of the GNOME-DB project
Vivien Malerba of the gASQL projectGiancar lo Capella, author of dbrepor t
I was pr ivileged to have e-mail exchanges with all of the above developers about var ious issues. They were consistently helpful, over looking my ignorance, and were excellent representatives of the Open Source ethic of community.
Thanks also is in order to the local L inux users' grouphttp://www.kalamazoolinux.org
The TopicThe Topic
There are a great var iety of relational database systems available forL inux, both Open Source and propr ietary. They range in featuresfrom the engineless SQL ite, to the read-or iented MySQL, to the ACID compliant PostgreSQL, and to incredibly expensive Oracle, Informix, and DB2
Then there are LDAP servers, mail servers, syslog files, NNTP servers,XML files, delimited files, fixed-length files, text files, spreadsheets, etc...
All these databases, servers, and files represent one thing: data, thereal reason we have computers in the first place. The need, not only torecord, but to sor t, calculate, repor t, cor relate, and " mine" , is thebasis of Information Technology. But while there seems to be noshortage of information on the " data sources" available for the L inuxplatform, cor responding information about tools to use that data seems to me to be lacking.
The ScopeThe Scope
This presentation is focused toward the Linux "power user", andattempts to provide a working understanding of the technologiesand tools available for data access on the Linux platform. Hopefully,it has enough depth to be of interest to budding developers as well.
The focus is on data-source independent tools. Therefore, tools linkedto a specific database (or other source such as an LDAP server)are not covered. Along that same line, ODBC and GDA which enable most such tools, are covered "in-depth".
Since the topic is restricted to data access on theLinux platform it does not include multi-platform data access tools written in Java or using the JDBC technology.Java is a registered trademark of Sun Microsystems Inc.
MethodsMethods
The overviewThe overview
Application Application Application
Bonobo
Gnome DB
Libgda
ODBC Driver
ODBC DriverManager
NativeLibrary
RDBMS NNTP RDBMSAnyCORBA
LDAPMailTextFile
OA
F / C
OR
BA
Pros & ConsPros & Cons
Native LibrariesFastestFewest DependenciesUsually Portable
ODBCUniform APIApp becomes quasi-independentof backend data store.Drivers available for non-relationaldata stores
GNOME DB (GDA)Objects and signals replace APIs.Inherent scalabilitySupport for Batch JobsAll advantages of ODBC
Native LibrariesEvery DBMS has a different API.Vendor may change API at will.Developer may need to deal witha lot of low-level issues.
ODBCLess efficient than native librariesRequires a driver/provider.Drivers/Providers vary in quality.More dependencies
GNOME DB (GDA)Under active developmentAll disadvantages of ODBC
Both ODBC and GDA have an application and library known as a manager that knows about available drivers / providers, and allows the definition of new data sources as well as creating connections/instances with defined data sources.
ODBC (drivers) and GDA (providers) accomplishpretty much the same purpose. They match up the ODBC or GDAAPI with that of a given datasource. Each type of data source used(PostgreSQL, Oracle, Text File) requires a driver/provider.
Both ODBC and GDA use the concept of a DSN(Data Source Name) thar corresponds to a defined data source. Allthe connection parameters are defined via the manager and are loadedwhen the application connects to a defined DSN.
Manager
Driver/Provider
DSN
Bot
h O
DB
C a
nd G
DA
intr
oduc
e se
vera
l ne
w t
erm
s, c
once
pts,
and
acr
onym
s.
TermsTerms
Native Native LibrariesLibraries
Native L ibrar iesNative L ibrar ies
Application
NativeLibrary
RDBMS
Native librar ies are usually provided in a SDK bythe producers of the database engine.
The librar ies are linked to the application when itis compiled.
Due to the " direct" nature, native librar ies are usually the fastest way to communicate with a database engine.
An example is " libpq.so" to which PostgreSQL applications are linked, with a " -lpq" directiveto the compiler .
FreeTDSFreeTDS(http://www.freetds.org)(http://www.freetds.org)
FreeTDS is an LGPL'd re-implementationof the Tabular Data Stream protocol (versions 4.2, 5.0, and 7.0) used by M icrosoft SQL server and Sybase products.
FreeTDS is used as the basis of unixODBC and Perl DBI dr ivers as well as a GDA provider .
When you build FreeTDS, you can specify the default version of the protocol you wish to use. This depends upon the product to which you desire to connect. --with-tdsver={4.2, 4.6, 5.0, 7.0}This can be over r idden at run time by using the TDSVER environment var iable or the config file which permits you tospecify the version used for a par ticular server.
MDB ToolsMDB Tools(http://mdbtools.sourceforge.net/)(http://mdbtools.sourceforge.net/)
MDB Tools is a collection of util ities for working with Jet 3 (Access '97) andJet 4 (Access 2000, Access 2002) data-bases.
Access, Jet 3, and Jet 4 are registered trademarks of Microsoft Corporation Inc.
In version 4, a small SQL engine for use with MDB files aswell as an ODBC dr iver for unixODBC is included.
The librar ies are released under LGPL while theutilities are released underGPL.
ODBCODBC
ODBCODBC
Developed by the Microsoft corporation as a way for applications to access a var iety of backend databases without source code modification
“ Maximum interoperability”
� Based upon open standards� X/OPEN� ISO/IEC� SQL
Has become a ubiquitous standard, even on non-Microsoft platforms, as is included with most Linux distributions.
All the API translation, etc... is performed on the clientmaking ODBC drivers platform specific.
unixODBC is an implementation of ODBC for GNUplatforms (L inux, FreeBSD, etc...) as well as UNIX(Sun, AIX, etc...).
unixODBC is distr ibuted under the LGPL so thatcommercial solutions can be based upon it without license concerns.
unixODBC is compatible with the ODBC 3.5 standard,can per form ODBC 3 to ODBC2 translation, as well as
UNICODE to ANSI translation.
unixODBCunixODBChttp://www.unixodbc.orghttp://www.unixodbc.org
Application
ODBC Driver
ODBC DriverManager
NNTP TextFile
NativeLibrary
RDBMS
Installing unixODBCInstalling unixODBC
/usr/local/odbc
bin lib include etcSystem-wide
Drivers and DSNsHeader
FilesODBC DriverManager and
Drivers.
Config toolsand command
line ODBCclient.
Almost everycurrent Linuxdistributionincludes unix-ODBC as apackage.
1. Download tar file from website.2. Unpack tar file. tar -xzvf unixODBC-2.0.4.tgz
3. Configure. ./configure --prefix=/usr/local/odbc --with-qt-dir=/usr/lib/qt-2.2.0
4. Compile. make
5. Install. make install
6. Add library to library path. echo "/usr/local/odbc/lib" >> /etc/ld.so.conf
7. Rebuild library index. /sbin/ldconfig
A normal unixODBC driver consists oftwo shared libraries, a driver library anda setup library.
Typically the setup library ends in a capital "S".
ODBC DriversODBC Drivers
Included DriversPostgreSQL: libodbcpsql.so
libodbcpsqlS.so
NNTP: libnn.solibodbcnnS.so
SQI/Flat File: libodbctxt.solibodbctxtS.so
MiniSQL: libodbcmini.solibodbcminiS.so
Drivers not included:Oracle: http://www.easysoft.orgMySQL: http://www.unixODBC.org/myodbc.htmlSybase: http://www.freetds.orgM$-SQL: http://www.freetds.orgAccess: http://mdbtools.sourceforge.netInformix: http://www.ibm.comDB2: http://www.ibm.com
unixODBC LibrariesunixODBC Libraries
All these librar ies should buildwhen you install unixODBC.
Cursor L ibrary: libodbccr .soLinked L ist Library: liblstcl.laSQI Library: libsqilc.laSQP Library: libsqlpc.laLogging L ibrary: libloglc.laTree L ibrary: libtrelc.laPostgreSQL Setup: libodbcpsqlS.soMiniSQL Setup: libodbcminiS.soMySQL Setup: libodbcmyS.soNNTP Dr iver Setup: libodbcnnS.soTXT Dr iver Setup: libodbctxtS.soesoob Setup: libesoobS.sooplodbc Setup: liboplodbcS.soFreeTDS Setup: libtdsS.soOracle Setup: liboraodbcS.soTXT Dr iver : libodbctxt.soNNTP Dr iver : libnn.so
The SQP library is a light-weight lex/yaccbased SQL parser used by unixODBC to permitSQL access to non-SQL sources such as NNTP.
The SQI library is a light-weight SQL enginethat uses text files as its data source; this is the" backend" to the ODBC TXT dr iver .
Much of unixODBC's functionality has been splitinto separate librar ies to facilitate code reuse inODBC dr ivers and allow the code to be " borrowed"by other projects.
Setup librar ies are typically built for all knownODBC dr ivers, even if the dr iver is not included orcannot be built due to lack of a SDK. This allowsyou to drop a dr iver in and " just star t using it" . The setup librar ies are often maintained by the unixODBC project and not the dr iver developers.
ODBCConfigODBCConfig
ODBCConfig provides an easy GUIenvironment for defining personalDSNs, or if you're r oot, installingODBC dr ivers and defining SystemDSNs. You can also control tracing,statistics gather ing, and connectionpooling.
The TXT(SQI) DriverThe TXT(SQI) Driver
Provides ODBC/SQL access to comma delimited files.... However there are the following limitations:
Slow on large files, no indexingNo locking or concurrency mechanismMaximum string per column is 255 charactersOnly simple statements supported
The first row of the file must contain the field names:name,alias,addressHomer,Happy Guy,635 Evergreen Terrace
The setup dialog lets you establish a directorycontaining delimited files. The names of thesefiles will be the corresponding ODBC tablenames. You also use this dialog to establishthe field delimiter.
Vpnusers::506:awilliamfloppy:x:19:swinters,britzwww:x:48:awilliam,nobodyconsole:x:11:utmp:x:16:pppusers:x:230:awilliam,britzpopusers:x:231:slipusers:x:232:slocate:x:21:xfs:x:233:saned:x:517:squid:x:234:sword:x:518:informix:x:519:
The TXT(SQI) DriverThe TXT(SQI) Driver
If you do not specify a directory in the setup dialog,the driver will use "$HOME/.odbctxt". If this directory does not exist, it will be created.
Since TXT files have no datatypes, all fields are interpreted as varchar(255). The application shouldhandle turning the string values into various otherdatatypes.
Delimited text files can be created using theSQL "create table" command. All datatypesshould be varchar(255).
The TXT driver is structured in such a way thatis should easily serve as the basis for other fileoriented ODBC sources such as XML or DBF.
The NNTP Dr iverThe NNTP Dr iver
Provides ODBC/SQL access to Usenet.... !!!However there are the following limitations:
Peculiar behavior at times (YMMV)Only simple SELECT
select summar y, sender , expires, subject, date, keywords, xr ef, host, path, distr ibution, refer ences, bodyfr om comp.os.linux
where subject like '%ssh% ';
Usenet groups are represented as tables.
Sections of the message are assigned field names:summary, sender , expires, subject, date, keywords,xref, host, path, distr ibution, references, body.
Currently this dr iver has no suppor tfor ODBC catalog functions, so you can't determine what newsgroups areavailable.
ODBCConfig StatsODBCConfig Stats
The ODBCConfig provides a " Stats" tabfrom which you can monitor the processesusing ODBC, the number of connections,cur rently executing statements, etc....
Statistical Term DefinitionsStatistical Term Definitions
Structure used by an ODBC application to manage its basic information such as required ODBC version and including connections. Acquired via a call similar to: SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &V_OD_Env)
Structure used by an ODBC application to represent a connection to a DSN. Contains both the state of the connection as well as pertinent parameters such as timeouts, etc.. Acquired via a call similar to: SQLAllocHandle(SQL_HANDLE_DBC, V_OD_Env, &V_OD_hdbc)
Structure used by the ODBC application to submitcommands to the backend, track state, and manage the results of a query.Allocated via a call similar to:
SQLAllocHandle(SQL_HANDLE_STMT, V_OD_hdbc, &V_OD_hstmt)
Structure used by the ODBC application to explore the organization of the results of a query: number of columns, field lengths, field types, etc... For programmers familiar with ESQL the descriptor handle takes the place of allocating an SQLDA (descriptor area).
Environment
Connection
Statement
Descriptor
OD
BC
app
licat
ions
ope
rate
by
allo
cati
ngha
ndle
s an
d p
erfo
rmin
g op
erat
ions
on
thos
e ha
ndle
s. T
here
are
fou
r ty
pes
of h
andl
es:
The PostgreSQL DriverThe PostgreSQL Driver
odbc.ini[KCC.MAIN]Description = PostgreSQLDriver = PostgreSQLTrace = NoTraceFile = Database = kcc.mainServername = localhostUserName = Password = Port = 5432Protocol = 6.4ReadOnly = NoRowVersioning = NoShowSystemTables = NoShowOidColumn = NoFakeOidIndex = NoConnSettings =
odbcinst.ini[PostgreSQL]Description = ODBC for PostgreSQLDriver = /usr/lib/libodbcpsql.soSetup = /usr/lib/libodbcpsqlS.soFileUsage = 1
The unixODBC suiteships with a PostgreSQLof its own. A driver,also developed by the PostgreSQL project, iscalled psqlODBC.
The PostgreSQL DriverThe PostgreSQL Driver
The ODBC standard mandates several catalog related functions that are not supplied by PostgreSQL configuration. But equivalent functions can be created by loading a set ofstored procedures into the template1 database and any existing databases: psql -d template1 -f odbc.sql
By loading these functions into the template1 database, theywill automatically be included in any subsequently createddatabases.
On RedHat 7.x the path of this file is: /usr/share/doc/postgresql-7.0.3/contrib/odbc/odbc.sql
Users of PostgreSQL versions prior to 7.x shoulduse the odbc-pre7 file to enable the extended catalog functions, and see the README file.
The MySQL DriverThe MySQL Driver
The MySQL driver is maintained by the MyODBCproject, a division of the MySQLproject.
odbcinst.ini[MySQL]Description = MyODBC MySQL DriverDriver = /usr/local/lib/libmyodbc.soSetup = /usr/lib/libodbcmyS.soFileUsage = 1
odbc.ini[Slash Installation 1]Description = MySQLDriver = MySQLServer = slashPort = Socket = Database = slash1
ODBC 3.5 compliant.
Informix & unixODBCInformix & unixODBC
odbcinst.ini[Informix]Descr iption=Informix IDS 2000Dr iver=/usr /local/informix/lib/cli/l ibifcli.soAPILevel=1ConnectFunctions=YYYDr iverODBCVer=03.00FileUsage=0SQLLevel=1smProcessPerConnect=Y
Do not use spare whitespace in the configurationfile entr ies. They will confuse the Informix dr iver .
odbc.ini[miecr ]Dr iver=InformixDescr iption=Pr imary Morr ison Industr ies DatabaseServer=BARNETDatabase=miecrCLIENT_LOCALE=en_us.8859-1DB_LOCALE=en_us.8859-1TRANSLATIONDLL=/opt/informix/lib/esql/igo4a304.so
The ODBC dr iver includedwith Informix Client Access orthe SDK does not “ suppor t” being managed via unixODBC, but if configured manually, itworks without complication.
All appropr iate Informix environment var iables must be defined for the InformixODBC dr iver to operate.
The ODBC dr iver includedwith DB2 does not “ suppor t” being managed via unixODBC, but if configured manually itworks without complication.
DB2 & unixODBCDB2 & unixODBC
With the DB2 dr iver the DSN(defined in odbc.ini) must be the name of the database.
odbcinst.ini[DB2]Descr iption = DB2 Dr iverDr iver = /usr /IBMdb2/V6.1/lib/libdb2.soFileUsage = 1DontDLClose = 1
odbc.ini[sample]Descr iption = Test to DB2Dr iver = DB2
All appropr iate DB2 environmentvar iables must be defined for theDB2 ODBC dr iver to operate.
http://www.unixODBC.org/doc/db2.html
Oracle & unixODBCOracle & unixODBC
Oracle does not provide an ODBC dr iver for anyplatform other than M icrosoft Windows.
A commercial Oracle ODBC dr iver for var iousUNIX and UNIX like platforms is available at:
http://www.easysoft.com/products/oracle
Microsoft Windows is a registered tr ademark of Microsoft Inc.Oracle is a r egistered trademark of Oracle Inc.
Access & unixODBCAccess & unixODBC
Access̀ 95, '97, 2000, and 2002 are r egistered trademarks of Microsoft Cor poration Inc.
/etc/odbc.ini[Soontobecorrupt]Dr iver = MSAccessDatabase = /usr /pcnet/waitfiveminutes.mdbDescr iption = Access file not cor rupted yet
/etc/odbcinst.ini[MSAccess]Driver = /usr /lib/libmdbodbc.so
Build the mdbtools package: ./configure --with-unixodbc --enable-sql make; make install to produce libmdbodbc.so, the unixODBC dr iver for Access '97, 2000, and 2002.
Access '95 MDB files are not suppor ted.
M$-SQL & unixODBCM$-SQL & unixODBCSybase & unixODBCSybase & unixODBC
/etc/odbcinst.ini[TDS]Description = FreeTDS ODBC DriverDriver = /usr/local/freetds/lib/libtdsodbc.so
/etc/odbc.ini[SunnyDale]Driver = TDSDescription = Very Very ProprietaryTrace = NoServername = bluescreen.ghena.comDatabase = Utumno
[global]tds version = 4.2initial block size = 512swap broken dates = noswap broken money = no
[SunnyDale]host = bluescreen.ghena.comport = 1433tds version = 7.0try domain logins = yestry server logins = nont domain = THRALLS
/etc/freetds.confThe FreeTDS library looks for /etc/freetds.conf. This configuration file is very similar in structure to that of Samba, providing a section for definition of global defaults and separate stanzas for each data source.
The FreeTDS website has links to several projects that provide interoperability with Sybase and MS-SQL.
??? & unixODBC??? & unixODBC
xBase Interbase Linter sqllite
Yard
Driver, NativeunixODBC
OperationalDriver
SetupLibrary
No.
?
No.
In progress.
In progress.
In progress.
Yes.
Yes.
Yes.
No.
?
No.
No.
No.
No.
Yes.
Yes.
Yes.
Yes.
Yes.
Yes.
No.
No.
No.
Driver, NativeunixODBC
OperationalDriver
SetupLibrary
Options:-b Batch mode no prompting-d{x} Delimit columns with-w Wrap results in a HTML table.-v Be verbose.
isqlisql
isql is a command line tool useful for usingODBC data sources from a dumb terminal or command line environment as well as processingbatch jobs (in conjunction with cron for example).
Syntax:
isql [DSN Name] [User Name] [Password] [Options]
It can be used in an interactive mode or by piping in SQLcommand to stdin, one statement per line.
The INI FilesThe INI Files
odbcinst.ini / .odbcinst.ini
This fi le, in {prefix}/etc, contains information about the installed ODBC dr ivers.
Access to this file should always bevia libodbcinst library calls. A command line tool odbcinst isprovided to facilitate batch access tothis fi le.
odbc.ini / .odbc.ini
This fi le, in {prefix}/etc, or thecorresponding file in the user 's home directory, contains information about configured DSNs (Data Source Names).
Access to this file should always bevia libodbcinst library calls. A command line tool odbcinst is provided to facilitate batch access tothis fi le.
odbcinst -i -s -f template_file
[MyPostgresDB]Description = odbcinst exampleDriver = PostgreSQLTrace = YesTraceFile = sql.logDatabase = adamServername = localhost
odbcinstodbcinst
Options-f Name of Template(valid for Install)-n Driver name or DSN (valid for Uninstall)-v Do not be verbose
Objects-d Driver-s Data Source
Action-i Install-u Uninstall-q Query
odbcinst is a command line thatfacilitates the scripted loading andunloading of drivers and DSNs,for application installers, etc...
odbcinst [Action] [Object] [Options]
Result code of zero on success.
The DataManagerThe DataManager
Allows you to browse ODBC datasources that support catalogfunctions, issue SQL sequences,view and save results, save and load SQL sequences, etc....
Open Office Data SourcesOpen Office Data Sources
Within Open Office / Star Office, various types of data sources are available, including ODBC. The Open Office ODBC subsystem works with the unixODBC driver manager so long as the library location is included in ld.conf or LD_LIBRARY_PATH. For an RPM installation of unixODBC, no configuration should be required.
Open Office Data SourcesOpen Office Data Sources
The user can define new data sources under Tools - > Data Sources. Once thetype ODBC has been selected, clicking the ellipses button will bring up a list ofthe data sources known to the unixODBC driver manager.
The user mustassign a uniquename to eachdata source.
Open Office Data SourcesOpen Office Data Sources
Once a data source has been declared the user must define the commonattributes such as user name, character set, etc...
Open Office Data SourcesOpen Office Data Sources
If the unixODBC driver supports catalog operations, the various tables are enumerated. Access via Open Office can be enabled or disabled on a table by table basis within the data source definition.
Open Office Data SourcesOpen Office Data Sources
The data source dialogprovides a full featuredSQL editor for executingarbitrary queries.
The SQL statements can be saved relative to the data source and recalled later by name.
Open Office Data SourcesOpen Office Data Sources
A GUI query builder isalso provided for thoseless proficient in SQL.
Queries can be savedrelative to the data sourceand recalled later by name.
Other ApplicationsOther Applications
Many (mostly commercial) applications support ODBCStarOffice 5.0, 5.1a, 5.2, 6.0 (5.1 non-a has several database related issues)Open OfficeApplixwareMost actively developed PHP applicationsGNOME Office(?)
KDE OfficeGNOME applications that support gnome-db.dbReporthttp://www.comm.cc/~gianx/dbreport/ Only recently, as Linux has entered the
enterprise, have many Open Source developersawoken to the importance of unified data storageand access methods and the difference between real database engines and over-hyped toys suchas MySQL. Projects like gnome-db aim to facilitate the rapid development of applications that provide these benefits.
ODBC Socket ServerODBC Socket Server(http://odbc.sourceforge.net/index.html)(http://odbc.sourceforge.net/index.html)
ODBC Socket Server is a multithreaded Win32 service for Microsoft Windows NT and 2000 that exposes proprietaryODBC data sources for XML queries via a TCP/IP port.
Clients are available for COM, Perl, PHP, Python, and C++.
Releasedunder GPL.
Other developers have contributed clientsfor Apple Macintosh, Tcl/Tk, and java.
Example data sources include Microsoft SQLserver, Microsoft Access, Borland data files,and any service where an ODBC driver isavailable for Win32 but no other platforms.
GNOME-DBGNOME-DB& GDA& GDA
Living up to its name.....Living up to its name.....
GNOME is the GNU Network Object Model Environment.It is not a window manager or a desktop, but a solution. Or in the words of the supreme chancellor of Ximian: Miguel de Icaza,an attempt to make UNIX not suck (and facilitate code re-use).
What is a " component model" ? Components are bits of software that provide some " standard" functionality such as viewing a PDF file,
an HTML page, or presenting the user with a versionof mine sweeper . What makes such a piece of softwarea component is that it is designed in such a way thatapplications can include it in an arbitrary fashion.
Bonobo: Making UNIX not Suck!Bonobo: Making UNIX not Suck!
Bonobo: Named after an endangered species of very promiscuous monkeys.
A Bonobo control is a CORBA server wrapped in the GTK+ objectmodel.
The point of components is to increase code re-use. For example:I f I 'm wr iting an application that needs char ts, I use the char t component instead of building yet-more-code to draw char ts. I f I do make a new component, it can save other developers time.
On wr iting a Bonobo Control:http://linux.denhaag.org/bonobo_controls/bonobo-controls.html
Makes sense for OSS developer s, yes?B
onobo:Abiw
ord in Evolution
Bonobo:A
biword in E
volution
Bonobo:A
biword in G
numeric
Bonobo:A
biword in G
numeric
The GNOME ArchitectureThe GNOME Architecture
Application(Gnumeric, gaSQL, etc...)
GNOME DB(Configuration Agent, Data source aware GUI components, etc....)
OAF
Bonobo
CAMEL(Messaging API)
GTK+(GUI & Object Model)
GDA(GNU Data Access)
CORBA (Heterogeneous RPC)
GDA Providers
NativeLibrary
LDAPServer
ODBCDriver (DSN)Other....
XML andXSLT support
In GNOME2, OAF has been renamed to bonobo-activation
CORBA is a multi-platform technology. ORBs andthe CORBA API are available on every significantplatform. This lends immense power and flexibility tothe GNOME component architecture.
The GNOME ORB is ORBit (http://www.labs.redhat.com/orbit/).
From http://www.gnome.orgTo make use of CORBA technology, applications must go through an ORB (Object Request Broker) library that implements the CORBA API. The ORB hides all the low level communications that are necessary for sending requests to objects, receiving replies from them, and making object implementations accessible. To the application, invoking an operation on a distributed object acts the same as a local function call.
CORBA: An RPC MethodCORBA: An RPC Method
CORBA : Common Object Request Broker Architecture
Think: Object Oriented RPC
CORBA & GNOME:http://developer.gnome.org/doc/guides/corba/html/book1.html
The CORBA IDL appears very similar to a C++ class definition, which is nearly what IDL is. IDL describes the methods and
attributes of a CORBA object. IDL is programming language neutral; each language that supports CORBA provides an IDL compiler which builds the necessary files (for example: header files in C/C++) to build an application that will use an object.
CORBA IDL CORBA IDL
IDL Interface Description Language
module car { interface wrecker { attribute string color; oneway boolean crashed(); boolean who_crashed(out string first_name, out string last_name); };};
Basically, the job of OAF is to keep a database (compr ised of an XML file for each available component) of components containing information about capacities, parameters, how to start them, etc....
OAF: Object Activation FrameworkOAF: Object Activation Framework(Now called (Now called bonobo-activationbonobo-activation))
For those familiar with GNOME, OAF will replace Gnorba in GNOME 2.0. Gnorba is deprecated.
<oaf_info><oaf_server iid=" OAFI ID:GNOM E_GDA_Provider _Default_ConnectionFactory" type=" exe" location=" gda-default-srv" > <oaf_attr ibute name=" repo_ids" type=" str ingv" > <item value=" IDL :GDA/ConnectionFactor y:1.0" /> </oaf_attr ibute> <oaf_attr ibute name=" descr iption" type=" str ing" value=" GDA Default Datasource Access" /> <oaf_attr ibute name=" gda_params" type=" str ingv" > <item value=" DIRECTORY" /> </oaf_attr ibute></oaf_server></oaf_info>
OAF stores its XML filesin /usr/share/oaf. Files putin /usr/local/share/oaf byTGZ packages will neverget seen.
Based upon Sun's JavaMail API
Views all message repositor ies as stores containing folders which in turn contain messages.
Has a plugin architecture to allow additional protocols to be added without application changes.
Full suppor t for IMAP, IMAP SEARCH, POP3, MIME, and vir tual folders.
Camel: Gener ic Messaging Camel: Gener ic Messaging L ibraryL ibrary
CAMEL is the foundation of the mail service of the Ximian evolution groupware product.
CAMEL is an acronym for : Camel's Acronym Makes Everyone Laugh
libgdalibgda(GNU Data Access)(GNU Data Access)
Requires ORBit, GConf, OAF and Glib.
Historylibgda was once part of the gnome-db project,but all dependencies upon GNOME have beenremoved so that it can be used in the developmentof non-GNOME and embedded applications.
What is is?libgda is a collection of CORBA IDL interfaces that providesstandardized access to a great variety of datasources.
It attempts to overcome the quasi-standardization of SQL and ODBC, and non-SQL datasources such as mail servers and directory services.
Packages are provided for both RedHat and Debian distributions.
Released under GPL/LGPL
gda Architecturegda Architecture
Application
The libgda client libraryHides the complexities of CORBA andany name-spaces or object activationrequired by the platform.
CORBA
GDA Provider
Data Store(ODBC, Native Library, etc..)
Scalability: Clients can share a GDA provider or request a unique provider. The provider can run in a separate address space than both the application and the actual data source. By allowing clients to share a data provider, you reduce the number of context switches on the host where the provider executes.
gda GNU Data Access
gda/libgda is actuallycompletely independentof the GNOME UI.
GDA also providesa "default" provider.
gda Providersgda Providers
Providers are not built by default, you must indicate at compile time what ones you want/need.
Configure script parametersRoot of package --prefix=<directory>Location of ODBC Libraries --with-odbc=<directory>Location of FreeTDS (M$-SQL) Libraries --with-freetds=<directory>Location of MySQL Libraries --with-mysql=<directory>Location of PosteSQL libraries --with-postgres=<directory>Location of Sybase libraries --with-sybase=<directory>Location of LDAP libraries --with-ldap=<directory>Location of ORACLE libraries --with-oracle=<directory>Location of Interbase libraries --with-interbase=<directory>Location of MDB libraries --with-mdb=<directory> Location of mail backend --with-camel=<directory>
Each provider has a Bonobo component to provide the GUIconfiguration interface to the GNOME DB front end.
Some providers are m
ore stable andcom
plete than others.
The Default ProviderThe Default Provider
Feature List of SQLite:Implements most of SQL92.A database is just a directory of GDBM files.Unlimited length recordsImport and export data from PostgreSQL.Very simple C/C++ interface (three functions and one opaque structure)A Tcl interface is included.Command-line access program sqlite uses the GNU Readline library.A Tcl-based test suite provides near 100% code coverageApproximately 9500 lines of C codeNo external dependencies other than GDBMBuilt and tested under Linux, HPUX, and WinNT.
libgda includes a "default provider"that is always built with the package.This guarantees the user at least ONEoperational provider.
**Shameless self promotion disclaimer**Take a look at the archived e-mail message found at:http://mail.gnome.org/archives/gnome-db-list/2001-April/msg00040.html
SQLite - a SQL front end to GDBMthat provides a single user engine-lessdatabase.
http://www.hwaci.com/sw/sqlite/
GNOME 1.4
Provider Status Provider Status(As of 27May2002)(As of 27May2002)
Operational in GNOME 2:MysqlPostgreSQL
Porting to GNOME 2:OracleSybaseODBCSqlite
Under Development:MDB (Access)
The default provider forGNOME 2 GNOME-DBis now an XML file.
The Interbase, LDAP, andmail (CAMEL based) providersare in need of developers.
GNOME DBGNOME DB
GNOME DB is a front end to the GDA data architecture,providing the ability to graphically configure providers,execute basic queries, etc...
GNOME DB provides a set of widgets and Bonobocomponents that are bound to GDA connections andcan be re-used in applications.
Widgets:GnomeDbLogin GnomeDbLoginDlgGnomeDbDsnConfigGnomeDbHelpViewerGnomeDbBrowser GnomeDbGridGnomeDbDataset GnomeDbComboGnomeDbList GnomeDbIconListGnomeDbReport GnomeDbDesignerGnomeDbHelp GnomeDbShortcutGnomeDbWindow GnomeDbErrorGnomeDbErrorDlg
The GUI tool provided by GNOME DB is "gnomedb-fe",with which you can:
Configure provider connections,View a providers logs,Browse tables, views, storedprocedure and data types,Send commands to the providerand view results (SQL), andManage "batch" jobs.
Building Gnumeric with Building Gnumeric with GDA SupportGDA Support
Unfor tunately, Gnumer ic does not ship with GDAor Bonobo suppor t enabled. This is done to maximize stability of the general release.
Gnumer ic's configure scr ipt has three options not enabled the standard build:--with-bonobo : which enables Bonobo controls--with-gda : which enables suppor t of GDA providers--with-gb : which enables suppor t of gb (GNOME Basic), a M$
Visual Basic compatible language for wr iting macros.
Notice from the 0.65 configure scr ipt:Please do not distr ibute prebuilt binar ies with bonobo suppor t.However , as of the 0.65 release we consider it stable enoughto accept bug r epor ts.
THIS SLIDE IS OBSELETE.
Using GDA from GnumericUsing GDA from Gnumeric
Access to GDA provides is via the execSQL function:=execSQL("gda_dsn", "username", "password", "select * from my_table")
Step-by-Step:1. Select the region you wish to fill with data.2. With the region selected, enter the execSQL function.* *Do NOT press <Enter>.3. PressCtrl-Shift-Enter** Some versions of Gnome-db contains a bug where you may have to press Ctrl-Shift-Enter twice.
Still undervery heavydevelopment
gASQLgASQL(http://gasql.sourceforge.net)(http://gasql.sourceforge.net)
What is gASQL? - Probably, the sweetest data access tool available for Linux. - A GUI front end to GDA providers - A GUI query builder - Modify data via dynamically generated forms
- Supports plugins to manage non-standard (BLOB, etc...) data types such as images, IP addresses, etc... - Relations between tables are defined graphically.
gASQL: Tables & ViewsgASQL: Tables & Views
The first gASQL you see after connectingto the database is " Tables & Views" . Fromhere you can see the entire content of a table or view, drop the table or view, oradjust its proper ties. Creating a table isnot yet suppor ted.
The queries you create in gASQLand the relationships you define canbe saved to an XML file via the" File" pull down menu. Save often.
gASQL: Table Proper tiesgASQL: Table Proper ties
The table's proper tiesdialog lets you bothsee the exact structureof a table and addrelationships to othertables.
gASQL: Database Relations gASQL: Database Relations (schema)(schema)
As you define the relationships between tables, gASQL creates a graphical representation of the database. You can view or alter this diagram by clicking on the "Relations" icon found in the "Tables & Views" screen.
gASQL: SequencesgASQL: Sequences
gASQL also allowsyou to view and destroysequences for the data-bases that support them.
Currently, the "CreateSequence" button is notactive.
A graphical representationis created as you addobjects to the query.
gASQL: Query BuildergASQL: Query Builder
gASQL also features avisual query builder. Bysimply selecting elementsthe user can build complex queries, gASQL uses therelationships defined between the tables to automatically tie everythingtogether.
gASQL: Query BuildergASQL: Query Builder
The query builder isquite powerful, not onlycan queries contain tablefields but also -
- Stored Procedures- Aggregate Functions- User Defined Functions- Fixed Values
The query builder willinclude fields required to tievarious tables together ifthe user does not manuallyadd them to his or her query.These are referred to as "Automatic Dependencies".
gASQL: Query BuildergASQL: Query Builder
To be certain gASQL hasassembled to query correctly, the user can viewthe actual text of the SQL statement.
The "Options" tabcontains order andgroup control for the query, but these are not implementedyet.
The "Where clauses" tab letsyou customize the order of eachelement in the where clause of the generated SQL.
gASQL: Form BuildergASQL: Form Builder
The "Edit Layout" functionis not currently enabled. Thisfeature will integrate gASQLwith GLADE.
A query can contain oneor more forms used to view and/or modify thecontents of the database.
A form is created "inside"the query to which it belongs, and the user canselect what operationsthe form is able to perform.
gASQL: FormsgASQL: Forms
gASQL forms allowthe user to easily modifythe contents of a databasetable.
gASQL: GridsgASQL: Grids
Grids can also be used toadd additional data to a table via dynamicallygenerated forms.
The user can also viewthe contents of a queryor an entire table, orview with the gASQLgrid options.
User defined forms maycontain a grid buttonin order to bring up a grid view of the query.
Currently, row deletion from a grid is not implemented.
gASQL: PluginsgASQL: Plugins
gASQL supports plugins for thevisual representation of non-textdatatypes such as images, networkaddresses, etc...
gASQL: PluginsgASQL: Plugins
Any field or data type can beassociated with a specific plugin.These plugins will then automatically be used in thevisual display of the data.
LinksLinks
On Writing a Bonobo Control:http://linux.denhaag.org/bonobo_controls/bonobo-controls.htmlGNOME & CORBA:http://developer.gnome.org/doc/guides/corba/html/book1.htmlThe ORBit Home Page:http://www.labs.redhat.com/orbit/The unixODBC Home Page:http://www.unixodbc.org/The GNOME-DB Home Page:http://www.gnome-db.org/Gnumeric Home Page:http://www.gnome.org/projects/gnumeric/gASQL Home Page:http://gasql.sourceforge.net/