Purpose: Serve as a collection point for work relating to interfacing between Tcl and databases. ---- There are a variety of issues relating to Tcl and databases. The first and most thorny, in '''my''' (LV) opinion is the selection of the ''right'' database. That is because that currently there is no generic interface to databases available in Tcl, so one has to either write multiple versions of an application, to support whatever databases the user community is going to be using, or you select one to support and force everyone to use that one, frequently by including the database code in the application itself. Both of these are uncomfortable decisions on the part of programmers who wish widest acceptance of their application. To find the various extensions mentioned below, visit http://www.purl.org/NET/Tcl-FAQ/part5.html . [Tom Poindexter] has written interfaces to [Sybase] and [Oracle]. Several people have written interfaces to [Berkeley DB], mini SQL ([mSQL]) and [PostgreSQL]. [Jean-Claude Wippler] has written an interface to [Metakit], which is a small database designed around the idea of variable persistence. Metakit has a wonderful Tcl binding that makes all the power of Metakit available in a natural and intuitive way. [OOMK] constructs Metakit objects and gives even more access, together with the benefits of [Snit]. [Jacob Levy] has written the [e4graph] extension for integrating graph structured data storage into Metakit. Interfaces to lesser known databases such as OBST, Coral, MOREplus, Qddb, etc. "Regular Expressions" ran a column [http://www.unixreview.com/articles/2001/0108/0108h/0108h.htm] on "Tcl and Database Managers -- A Survey" in August 2001. A mailing list to discuss database APIs is available at mailto:tcldb-request@ucolick.org . A page here is devoted to generic [Database Interface]s. ---- Several of the extensions mentioned above live on SourceForge now: * [Category Regular Expression Tools Applications in Tcl-Tk] http://sourceforge.net/projects/isqltcl/ . * [Metakit] http://sourceforge.net/projects/metakit/ . * [Category Science Applications in Tcl-Tk] * [Oratcl] http://sourceforge.net/projects/oratcl/ . * [tclODBC] http://sourceforge.net/projects/tclodbc/ . * [libpgtcl] http://gborg.postgresql.org/project/pgtcl/projdisplay.php * [MySQLtcl] * [Starbase.tcl] * [Sybtcl] http://sourceforge.net/projects/sybtcl/ . Please add any extension I forgot, '''[AK]'''. Thanks. ---- Don't forget that [AOLserver] has its own drivers for many databases ([Oracle], [PostgreSQL], [Sybase], [Solid], etc.), all accessible from the same ns_db Tcl API. And the AOL maintainers have started [refactor]ing the C code to make some of this stuff shared libraries, and thus potentially very useful in non-AOLserver environments as well... * http://mini.net/tcl/2078 * http://aolserver.com/ ---- Here are a variety of other Tcl database bindings * Berkeley Database http://www.sleepycat.com/ ''Includes Tcl Extension for accessing all the functionality'' * Blackbourn's Minerva miniSQL (mSQL?) binding ftp://ftp.procplace.com/pub/tcl/sorted/packages-7.6/databases/libmsqltcl-1.0/libmsqltcl-1.0.tar.gz * DAS (Database Abstraction Standard) http://www.qs.co.nz/Tcl/DAS.html * db2tcl (DB2) ftp://ftp.procplace.com/pub/tcl/sorted/databases/db2tcl/1.0/ (is it true that DB2's native interface is so close to ODBC that TclODBC can be the basis for a "native" binding?) * debbie (Oracle binding) http://www.davudsplace.net/debbie1.html * Doan's GDBM Tcl binding ftp://ftp.procplace.com/pub/tcl/sorted/packages-7.6/databases/tclgdbm1.0/tclgdbm1.0.tar.gz * FameTcl http://www.pedestalsoftware.com/fame.htm * FrontBase http://www.frontbase.com (see the downloads area) * Generic database interface http://www.velocigen.com/%7Etdarugar/tcl-sql/ * Janich's mSQL binding http://home.netvigator.com/%7Emjanich/nanosoft/download.html * Maxwell's [Postgres] binding ftp://ftp.procplace.com/pub/tcl/sorted/packages-7.6/databases/PQtcl/PQTcl.tar.gz * Natural Language Inc's NLI binding ftp://ftp.procplace.com/pub/tcl/sorted/packages-7.6/databases/NLItcl/NLItcl.tar.gz * NeoSoft Tcl (includes a database interface) ftp://ftp.procplace.com/pub/tcl/neosoft/neotcl/ * OBST binding ftp://ftp.fzi.de/pub/OBST/OBST3-4.3/ ftp://ftp.uu.net/pub/database/obst/ ftp://src.doc.ic.ac.uk/computing/databases/OBST/ * Pepers' mSQL binding ftp://Bond.edu.au/pub/Bond_Uni/Minerva/msql/ * Pgtcl included in standard distribution of http://www.postgresql.org/ (don't use other drivers, the included one is ok) * PiTcl (PalmOS database) http://www.purl.org/NET/akupries/soft/pitcl/ * RDB binding ftp://ccfadm.eeg.ccf.org/pub/ctk/rdb.tar.Z * sdb (simulation database) ftp://ftp.procplace.com/pub/tcl/sorted/packages-7.6/databases/sdb-0.1/sdb-0.1.tar.gz * SNM db http://sistemac.carnet.hr/%7Eddelija/tools/TCLSNM/swig/ http://malik.srce.hr/CARNet/tools/TCLSNM/ * Soderstrom's mSQL binding ftp://Bond.edu.au/pub/Minerva/msql/Contrib/ * SOLID (an ODBCish binding) http://www.solidtech.com/market/products/web/ * SQL Tcl http://sourceforge.net/projects/tclsql * stk-mysql ftp://cliffs.ucsd.edu/pub/terry/stk-mysql.tar.gz * TKHINote http://www.electricmemo.com/ * tQL http://www.rose-cottage.demon.co.uk/tql/ * Weilguni's GDBM Tcl binding ftp://ftp.procplace.com/pub/tcl/sorted/packages-7.6/databases/TclGdbmWrapper-01.pl1/TclGdbmWrapper-0.1pl1.tar.gz * Wieck's [Postgres] binding ftp://ftp.procplace.com/pub/tcl/sorted/packages-7.6/databases/Postgres_pqatcl-1.0/Postgres_pqatcl-1.0.tar.gz * [A Mini Database Manager] * [AdabasTcl] ftp://ftp.procplace.com/pub/tcl/sorted/packages-7.6/databases/adabastcl-1.0/adabastcl-1.0.tar.gz * [db2tcl] * [INGRES] binding ftp://ftp.procplace.com/pub/tcl/sorted/databases/tclsql-1.1/ or ftp://ftp.procplace.com/pub/tcl/sorted/packages-7.6/databases/tclsql-1.1/tclsql-1.1.tar.gz * [Interbase] [[alphabetize under "Interbase"]] ftp://ftp.procplace.com/pub/tcl/sorted/packages-8.0/databases/ibtcl/1.0/ * [LDAP] (Lightweight Directory Access Protocol) ftp://ftp.procplace.com/pub/tcl/sorted/packages-7.6/databases/tclLDAP-2.1/tclLDAP-2.1.tar.gz * [mySQL] * [PostgreSQL] binding http://www.postgresql.org/ * [SQL Relay] [http://sqlrelay.sourceforge.net/] "has native client API's for" several languages, including Tcl, connecting to several different "database backends." * [sqlite] * [Stefan Vogel]'s extended GDBM Tcl binding (even for windows) http://www.vogel-nest.de/wiki/Main/TgdbmPage (in Version 0.5 as of April 2005) * [TclVSdb] * [D. Richard Hipp] provides [SQLite]. * [Migrating MS Access to other databases using XML], [XSLT] is in there too. * [Ed Hume] has an in-memory SQL database at http://www.hume.com/ * [Michael A. Cleverly] has [nstcl] * [David Bigelow] provides [TimpleSQL] * [Rivet] contains the [DIO] database layer that permits the use of different backends such as mysql or postgresql. * [VI] provides [DBM] for berkely dbm * [XOSql] is OO [XOTcl] wrapper (fasade) for [mysqltcl] [PostgreSQL] [sqlite] and [tclodbc] * http://field.medicine.adelaide.edu.au/%7Ecolin/libtclpq/ * http://www.ucolick.org/%7Ede/tcl_syb/wisql.html * [tcldbi] ---- See also [Database Interface] , [A simple database] , [BOOK Database Backed Web Sites], and the Developer Exchanged information site, http://www.purl.org/tcl/home/resource/software/extensions/database/ . [Arts and crafts of Tcl-Tk programming] [Discussions on making data file access simpler] ---- So why hasn't the Tcl community come to an agreement on one generic database interface in a fashion similar to Perl's DBI module? [RLH] 2005-07-19: Exactly! [WK] Well, there's [tcldb] that does that. It may not be the most lightweight interface, but it seems to do the trick. It also (which IMHO is more important) handles some differences between databases (like FORMAT_DATE vs TO_CHAR, NOW vs CURRENT_* and so on). See http://dqsoftware.sourceforge.net/, there's an upcoming release when I finally find the time for it really soon (stated 2006-05-23). ---- [Comparing Tcl database abstraction layers] ''... is one way of plugging different DB backends into an app without (ahem) altering an app. A slightly different angle on this would be to aim for a common API/protocol, without completely "wrapping" the DB. -[jcw]'' IOW, instead of creating code ''through'' which all requests are made, an OO-ish option would be to return a database handle (as some wrappers already do), and insist on a sufficiently similar set of method names and conventions that the same calls will work across different database extensions. Nothing stellar, but perhaps good enough? I know of at least one (now obsolete) wrapper which did this by emulating [Tclodbc]. ---- Basic question re: MSSQL database access [JDM] 2006-08-02: One interface that I do not see above is for MS SQL Server databases. Is this because none is needed? Or because the Sybase interface will work? Or because no one has written one specifically for MS SQL so ODBC connections should be used? I apologize if I have overlooked something. [TP] answers 2006-08-02: For MSSQL interface, [Sybtcl] should work, and I would recommend using the FreeTDS [http://freetds.org] interface library, as it can compile options to include various MSSQL protocol versions. FreeTDS can also build an ODBC driver, so [Tclodbc] works too. For most of my DB interface needs lately, I've been using [Tclodbc] on both Unix/Linux and Windows. [JDM] 2006-08-02: Many thanks for the quick answer! I will try [Tclodbc]. As someone new to TCL, I am looking for examples that use Tclodbc as well. Can you point me to any? Thanks in advance. ---- [[ [Category Mailing List] | [Category Database] ]]