MySQL

MySQL is an open-source database system. See below for further details.

See Also

MySQL Tcl Bindings
MySQLUsers
applications in Tcl that use MySQL
MySQL: Forked beyond repair? , Neil Mcallister, 2003-05-21
FBSQL
MySQL Tcl extension with emphasis on flexibility and perfomance.

Tutorials

Beginning MySQL Tutorial , W.J. Gilmore, 1999-04-03

Description

"MySQL is the world's most popular Open Source Database, designed for speed, power and precision in mission critical, heavy load use." In Sep 2002, they won the Linux Journal's Editors' Choice Award. From the article:

''If you're one of the people who has been saying, 'I can't use MySQL because it doesn't have [feature you need here]', it's time to read up on MySQL 4.0 and try it out on a development system. Can you say, 'full support for transactions and row-level locking'? 'UNION'? 'Full text search'? - http://www.mysql.com/

Example

Silas 2005-10-05: I've used the following code to test the MySQL remote server each one second with a recursive proc and connect if the internet is on (I'm using FBSQL here):

#make the connection
proc mysqlConnect {} {
    set error [catch {
        set result [exec ping -c 1 $glo::db(host) | grep received]
    } error_message]

    if {$error} {
        if {$glo::db(connected)} {
            tk_messageBox -message "The connection has been lost. It will be connected in $glo::db(time) seconds."
            set glo::db(connected) 0
        }
        puts $error_message
        after [expr $glo::db(time) * 1000] {mysqlConnect}
        return
    }

    set index [string first {1 received} $result]
    puts "($index) $result"

    if {$index && $glo::db(connected) == 0} {
        if {[tk_messageBox -message "The net is OK. Do you want to connect?" -type yesno] == yes} {
            set error [catch {sql connect $glo::db(host) $glo::db(user) $glo::db(pass)} error_message]
            sql selectdb $glo::db(db)
            set glo::db(connected) 1
        }
    }

    after [expr $glo::db(tempo) * 1000] {mysqlConnect}
}

LAM(2017-04-20)

tdbc with mysql can't load library ...

Working on Windows(XP/7) with the mysql driver of tdbc you could get a message like

couldn't load library "libmysql.dll.15": this library or a dependent library could not be found in library path

The problem is just that your script can't load libmysql.dll.

Solution?. This dll is part of Connector/C (libmysqlclient), a client library for C development, then

1-Download mysql-connector-c-6.1.9-win32.zip from libmysqlclient

2-Unpack and copy libmysql.dll in the directory "\windows\system32" (i.e. c:\windows\system32)

Notes:

1)Instead .zip could be .msi depending of the version(32 or 64 bits).

2)Depending of restrictions or requeriments, you could to copy the dll in the directory of your script.

RickH (2017-04-20)

Please note that the unziped file produces two modules: the .dll and the .lib.

Both need to be made accessible for tdbc::mysql to work.