tcl/tk programming to a database

Posted on 2009-04-05
Last Modified: 2013-11-22
I am writing a very simple piece of software in TCL/TK under the linux environment and want to store the data in a database. I have never written any software to interact with a database so this is a first for me. I need to know what databases I can use with TCL/TK and which would interact best with what I want to do if I have multiple choices. I would like to stress that I have never dealt with databases ever before. If there is a tutorial with example code that would be great start. Any and all help will be appreciated.
Question by:georgopanos
  • 3
  • 2
LVL 24

Accepted Solution

fridom earned 500 total points
ID: 24074678
In short you can probably use any Database you can get your hands on.

See e.g

And well if there is not a direct TCL binding there will be some C binding  and you can use any C writen stuff very easily with tcl.


Author Comment

ID: 24093078
This was a very good start but since I have never worked with databases before it is a little difficult to understand. Is there any concrete code that is a simple database program written in TCL that uses MySQL so I can read the code and understand the interaction between the database and TCL code?
LVL 15

Expert Comment

ID: 24093658

As an example (from
 package require mysqltcl

 set m [mysqlconnect -user root -db mysql -password foobar]

 mysqluse $m mysql

 foreach res [mysqlsel $m {select host from user} -flatlist] {

     puts $res


 mysqlclose $m

Open in new window

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

LVL 24

Expert Comment

ID: 24094082
There are tons of examples e.g in Openacs codebase, it even connects that with
HTML rendering. There is one exceptional book available which just discusses that. It's named
Philip and Alex's Guide to Web Publishing.


Author Comment

ID: 24122248
Thank you fridom for your help the combination of those pages and a blip from Professional Linux Programming from Jon Masters helped  quite a bit. I have not completed a program to communicate with the mySQL DBASE yet.
LVL 24

Expert Comment

ID: 24154746
Have you tried



Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to eliminate duplicates from a list of hosts in groups 2 51
Building Windows 10 1 76
Sed question 2 70
How can I save all open docs into a given folder 12 92
It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now