Tag Archives | MySQL

Happy Memorial Day

A rare day off at Ted Roche & Associates, LLC. Still, spent an hour
this morning posting some solutions to MySQL queries to the ProFox
list, and a few hours working on a chapter about connecting to MySQL
from Visual FoxPro. But also got some time in with Laura working on
roman shades in the office. And, lest we forget, more than a few
minutes remembering those who sacrificed so we could enjoy the freedom
of the holiday. Have a good Memorial Day.

MySQL Connectivity with Python

Great article over at DevShed on connecting to a MySQL database using the Python language. Folks familiar with ADO or with SQL Pass-through and the VFP way of manipulating cursors will be comfortable with code like this:

#!/usr/bin/python
# import MySQL module
import MySQLdb
# connect
db = MySQLdb.connect(host="localhost", 
user="joe", passwd="secret",db="db56a")
# create a cursor
cursor = db.cursor()
# execute SQL statement
cursor.execute("SELECT * FROM animals")
# get the resultset as a tuple
result = cursor.fetchall()
# iterate through resultset
for record in result:
        print record[0] , "-->", record[1]

Mary Jo lambasts yet another Microsoft ‘study’

Microsoft Watch from Mary Jo Foley reports Microsoft Funds More ‘Facts’. “Microsoft is touting a new “independent” study aimed at helping users make fact-based choices between operating systems. This time, the study was performed by Jupiter Research and commissioned by Microsoft.”

Yet another suspicious “study,” although the devil’s in the details more than the farcical “a mainframe costs more than a bunch of server” study. In this case, there is no “study” really, but a survey of the opinions of people (presumably IS Managers) about what they know about interoperability. That’s surely not the same as evaluating what sort of interoperability is out there. I’ve automated OpenOffice.org from VFP, and you can do so from Perl, Python, Java or C++. I run my SourceSafe files from a Samba share on a Linux box. I can read and write MySQL tables (on any platform) via ODBC or JDBC or Perl libraries or other interfaces. Now, that’s interoperable!

Linux Work

So, this weekend I’ve got some time to spare and dedicated it to restoring my Linux laptop to life. I foolishly tried to update to RedHat 9 from 8 without considering the limitations of a 6 Gb hard drive with 2 Gb already dedicated to another OS. I was surprised that RedHat crashed the machine, rather than gracefully declined, but it left the machine a mess, with two hard drive partitions full to overflowing, and an OS that would boot and then lock up attempting to start X Windows.

My first urge was to just blow away everything and start again. However, that really isn’t the way to learn anything. Instead, I took it as a learning experience. What if a client had a locked-up or corrupted machine, but needed to recover some precious files? Looked at in this light, I hadn’t encountered a problem, but rather an educational opportunity.

I used a Knoppix 3.3 CD to boot into a working Linux OS, and then followed the Repair FAQ on the Knoppix site to clean some space off each partition. I also used the RedHat 9 CDs in “repair” mode to clear off still more files, test the file systems for integrity, and get the system to restart.

There were a number of problems with my last set of installs, and I set off to fix them. First, I got a few of the basic services restarted. I reconfigured the networking software to use the docking station’s ethernet rather than the wireless card. Once I was satisfied that was working properly, I reconfigured TCP/IP for a static address and programmed the router to allow minimal services to be exposed to the outside world – port 8080 for Apache and 23 for SSH. Over Apache, I’m running Twiki, a wiki written in Perl, and I use port 23 for a secure tunnel for shell work and also to run a remote graphical session via VNC.

Next, I tried to set up Samba, and ran into some problems. The RedHat Network insists the latest Samba for my distribution is 2.2.7-5.8.0, while I had somehow installed a 2.2.8a on the system, I suspect by downloading the wrong version directly from the Samba site. The installer wanted the Redhat 8 CDs, which I had given away, so BitTorrent to the rescue, and I was able to download and burn a new set of disks from rpmfind.net. Uninstalling the wrong version and finally getting the correct version installed was an education in the Redhat Package Manager (RPM) command line, but I am up and running.

Today, the goal is to configure MySQL and the MyODBC software so that I can read and write MySQL data from my Windows workstation. Onward and upward!

Where to, next? Part III

It sounds pretty obvious, but after you’ve gotten the machine installed
and flubbed around with it for a while (“Look, Mozilla is pretty cool!
Check out OpenOffice.org!”) the next thing to do is… figure out what
to do next. Everyone has their top priority… a print server, a file
server, a web server, a database server, an office workstation, a
kiosk, a router, a firewall. There a million different configurations
and permutations and combinations you can figure out for your new
machine. Pick one. Take your time and research it and configure it and
try it out. In the process you’ll learn lots about the command shells,
the security model, the different ways of packaging and installing
software. Here’s what I’ve tried so far:

And, not all of these experiements have to occur on the Linux box
alone. My MySQL experiments used the Linuxbox as the database server
and VFP on a Windows laptop. One of the several Perl and Twiki
installations I’ve made was also on a Windows server, using the CygWin DLL to provide command-line equivalents for RCS functionality in Windows.

Powered by WordPress. Designed by Woo Themes

This work by Ted Roche is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States.