Skip to site navigation

Web support banner

Calling MySQL from Tcl

MySQL databases can be accessed by scripts written in the Tcl scripting language on Socrates and Plato. The following example examines table people in database ucabwww, owned by user ucabwww:

tclsh8.3
% package require mysqltcl
2.0rc11
% set h [mysqlconnect -h mysql-server.ucl.ac.uk -u ucabwww -password secret]
mysql0
% mysqluse $h ucabwww
% mysqlsel $h "select name,age from people" -list
{fred 23} {mary 34} {john 44} {jane 56} {tony 98}
% mysqlclose $h
% exit

Detailed documentation of mysqltcl can be found at http://www.xdobry.de/mysqltcl/mysqltcl.html.

Page last modified on 14 apr 10 09:55