[[...]] [[... Jet ...]] "MDB Tools is a package of libraries and utilities that allow Unix-like systems to natively read Microsoft Access database (MDB) files." http://www.sourceforge.net/projects/mdbtools/ A simple way to interact with Access is via [CSV] files (see also the links there) - plain text files with comma-separated values (in German locale, Access does not allow to use commas though, because it is considered decimal separator, so use semicolons instead; Excel accepts commas though... ([RS]) [TDBC] [Tclodbc] [SQL Relay] "Jet" is Access's persistence back-end, and the aspect of Access most likely to interest Tcl developers immediately. Win* has bundled Jet for several years now--write a Jet-dependent application, and it should work fine on any Win* host (since Win95?). 'CEPT that now, in 2002, MS has changed the name again, this time from "Jet" to "MSDE". [http://mdbtools.sourceforge.net/] might explain more ... It's also called "MDB" and "MSDB". ---- [Scott Gamon] - I'm pasting in this c.l.t. post by [Kevin Kenny], so I don't lose it: You can use [database configure] to create an Access database - in fact, you don't even need Access on the system. (You do need Jet, but I don't think I've ever seen a Windows box without it.) Try the following code. It creates an empty MDB file at the location the user gives and then opens it. ====== package require Tk package require tclodbc # Prompt the user for a database to create # (For opening an existing database, use tk_getOpenFile instead of # tk_getSaveFile) set types { {{Access Databases} {*.mdb} } } set fileName [tk_getSaveFile \ -defaultextension .mdb \ -filetypes $types \ -initialdir ~ \ -title "Create Database"] # Quit if the user cancels. if { ! [string compare {} $fileName] } { exit } # Create the database. (Omit this if opening an existing database) set driver {Microsoft Access Driver (*.mdb)} database configure config_dsn $driver \ [list CREATE_DB=\"[file nativename $fileName]\" "General"] # Connect to the database. set connectString DRIVER=$driver append connectString \; DBQ=[file nativename $fileName] append connectString \; {FIL=MS Access} append connectString \; EXCLUSIVE=Yes puts $connectString database db $connectString ====== ---- see also: [a form for Access Database] ---- [etdxc] - Just a quick note. When using tclodbc to work with Access memo fields, if you insert a record which contain a memo field that contains a large amount of data, you may get a problem rereading it. TclOdbc returns all the data associated with the memo, spurious or otherwise. In a rush (as always) I found the easiest solution is to store the memo as a two element list (or as two seperate fields), index 0 contains an integer 'size' of the memo and index 1 the memo itself. Use lrange to extract the actual stored text. Of course there may be a (lot) better method. If so, please let me know. ---- [[Jet, ... [Windows] ... [ODBC] ...]] ---- Regarding "Access browsers": "[Sourceforge] has a project called mdbtools [http://mdbtools.sourceforge.net/] which can dissect access files. I believe that it offers an [API] which can be pretty easily wrapped and though it is not completely stable (according to traffic on their mailing list) seems to do a pretty good job. They also offer a rudimentary ODBC driver." "While I know very little about most of these applications, here's [http://www.snapfiles.com/freeware/webpublish/fwdbquery.html] a list of freeware database tools on Snapfiles: I have had some experience with both WinSQL Lite and SchemaPlus Lite - both of which are quite good and will likely do what you need." "I've used QTODBC which is reviewed here [http://www.mindcracker.com/mindcracker/c_cafe/database/tools2.asp]." ---- [RS] 2008-06-18: Here's a cute little tool to dump a table of a .mdb database in to stdout in semicolon-separated format: ====== #!/usr/bin/env tclsh set usage { usage: mdb2csv.tcl mdbfile table > csvfile Dump a MS Access database table to stdout in CSV format. MS Access must be running for this to succeed. } if {[llength $argv] < 2} {puts stderr $usage; exit 1} proc main argv { package require dde foreach {mdbfile table} $argv break set request "$mdbfile;TABLE $table" set it [dde request MSAccess $request All] foreach line [split $it \n] { puts [string map {\t ;} $line] } } main $argv ====== <> Database | Application | Windows