Mysqltcl is a simple API for Mysql-Database and Tcl script language.
In order to connect to mysql in Tcl programming, we can choose mysqltcl. Mysqltcl is on this website: http://www.xdobry.de/mysqltcl/index.html.all of us can get it on this site.
For mysqltcl, it has version on windows and Linux. Today i just give the usage on windows 7.
1: install ActiveTcl and mysql server on windows.
install ActiveTcl can reference this blog: http://www.jyguagua.com/?p=427
install mysqlserver can reference this site: http://jingyan.baidu.com/article/48b558e37c20e77f38c09a16.html
2:when mysql have installed, the server user:root and password:root, I create a database "blog" and it has table "user" and table "user" has one record: "name":"ypf", "password":"ypf", "id":"1".
3:download mysqltcl for windows and install it.
mysqltcl download page:http://www.xdobry.de/mysqltcl/windows.html
I use the latest version:mysqltcl-3.03.zip
how to install it? very easy, unzip the file in your Tcl/lib dictonary. (default C:/Tcl/lib dependent on your Tcl install path).
4: Programming tcl and connect to mysql and query table "user" with sql language "select * from user;"
db.tcl:
package require mysqltcl
set m [mysqlconnect -user root -db blog -password root]
mysqluse $m blog
foreach res [mysqlsel $m {select * from user} -list] {
puts "name is [lindex $res 0]"
puts "pass is [lindex $res 1]"
}
then in cmd I can execute the tcl with tclsh:
all the mysqltcl API at here:
http://www.xdobry.de/mysqltcl/mysqltcl.html
you can also get more info at: http://www2.tcl.tk/6051
文章的脚注信息由WordPress的wp-posturl插件自动生成



微信扫一扫,打赏作者吧~![[整理][转载]win下网卡抓包发包库Npcap使用](http://www.jyguagua.com/wp-content/themes/begin/timthumb.php?src=http://www.jyguagua.com/wp-content/uploads/2023/08/demo_1-1024x711.jpg&w=280&h=210&zc=1)
![[转载]基础数据char,int,double,string是线程安全的吗?](http://www.jyguagua.com/wp-content/themes/begin/img/random/17.jpg)
![[整理]how to run flask with pyqt5](http://www.jyguagua.com/wp-content/themes/begin/timthumb.php?src=http://www.jyguagua.com/wp-content/uploads/2021/03/pyqt_flask.png&w=280&h=210&zc=1)
![[已解决]LINK : fatal error LNK1158: cannot run 'rc.exe' 错误的解决办法](http://www.jyguagua.com/wp-content/themes/begin/timthumb.php?src=http://www.jyguagua.com/wp-content/uploads/2021/02/Snipaste_2021-02-17_15-18-26-1024x505.png&w=280&h=210&zc=1)