Version 9 of Microsoft Access

Updated 2005-12-12 00:21:50

[...]

[... 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)

Tclodbc

"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". [L1 ] 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.


Category Database