Planning out my year, I decided to take the Oracle OCP and MySQL OCP exams. I checked for review books and was pleasantly surprised to find the soon to be released OCP MySQL Database Administrator Exam Guide (Exam 1Z0-883). However, I noticed that the book was actually prepared for the obsolete and discountinued Exams 1Z0-870, 1Z0-873, and 1Z0-874. As it turns out, Steve O’Hearn has informed me that there isn’t a book and that the posting in Amazon.com is in error.
…[Read more]Last week I posted how to configure and test Ruby and MySQL. Somebody asked me how to handle a dynamic list of columns. So, here’s a quick little program to show you how to read the dynamic list of column:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
require 'rubygems' require 'mysql' # Begin block. begin # Create a new connection resource. db = Mysql.new('localhost','student','student','studentdb') # Create a result set. rs = db.query('SELECT item_title, item_rating FROM item') # Read through the result set hash. rs.each do | row | out = "" i = 0 while i < db.field_count # Check if not last column. if i < db.field_count - 1 out += "#{row[i]}, " else out += "#{row[i]}" … |
It turns out that configuring Perl wasn’t the last step for my
student instance. It appears that I neglected to configure my
student instance to support Java connectivity to MySQL. This post
reviews the configuration of Java to run programs against MySQL.
It also covers the new syntax on how you register a
DriverManager
, and avoid Java compilation errors
with the older syntax.
In prior posts, I’ve shown how to use Perl , PHP, Python, and Ruby languages to query a MySQL database on Linux.
You need to install the Open JDK libraries …
[Read more]Sometimes trying to keep a post short and to the point raises other questions. Clearly, my Python-MySQL Program post over the weekend did raise a question. They were extending the query example and encountered this error:
TypeError: range() integer end argument expected, got tuple. |
That should be a straight forward error message because of two
things. First, the Python built-in range()
function
manages a range of numbers. Second, the row returned from a
cursor is actually a tuple (from relational algebra), and it may
contain non-numeric data like strings and dates.
The reader was trying to dynamically navigate the number of columns in a row by using the …
[Read more]Configuring Perl to work with MySQL is the last part creating a complete Fedora Linux LAMP stack for my students. Perl is already installed on Fedora Linux.
I’ve also shown how to use PHP, Python, and Ruby languages to query a MySQL database on Linux. After installing this additional Perl DBI library, my students will have the opportunity to choose how they implement their LAMP solution.
You can find the Perl version with the following
version.pl
program:
1 2 3 4 |
#!/usr/bin/perl -w # Print the version. print "Perl ".$]."\n"; |
This post works through the Python configuration of Fedora
instance, and continues the configuration of my LAMP VMware
instance. It covers how you add the MySQL-python
libraries to the Fedora instance, and provides the students with
one more language opportunity for their capstone lab in the
database class.
A standard Fedora Linux distribution installs Python 2.7 by
default. Unfortunately, the MySQL-python
library
isn’t installed by default. You can verify the Python version by
writing and running the following version.py
program
before installing the MySQL-python
library:
1 2 3 4 5 |
# Import sys library. import sys # Print the Python version. print sys.version |
You can run the version.py
program dynamically like
this from the current working directory:
What the MySQL team is doing with JSON (JavaScript Object Notation) in MySQL 5.7 is great! The MySQL Server Blog (Rick Hillegas and Dag Wanvik) published two key articles about new JSON functions. If you don’t follow these, let me highlight them as a set:
Most folks know how important JSON is to web development. I like the following visual that …
[Read more]
After you install Ruby and build the Rails framework,
you need to create the mysql
gem. This blog post
shows you how to create the mysql
gem and how to
write a simple Ruby program that queries the MySQL database.
The first step creates the mysql
gem for Ruby
programming:
yum install mysql |
It should show you the following:
Fetching: mysql-2.9.1.gem (100%) Building native extensions. This could take a while... Successfully installed mysql-2.9.1 Parsing documentation for mysql-2.9.1 Installing ri documentation for mysql-2.9.1 Done installing documentation for mysql after 0 seconds 1 gem installed |
After you install the mysql
Ruby Gem, you can write
and …
I use a Fedora 20 VM image to teach Oracle and MySQL technology. Last week, I expanded the Fedora VM image to support a full LAMP stack. This blog shows you how to install Ruby on Fedora and successfully generate the Rails gems.
Connect as the root
user and use yum to install the
libraries. My approach is by library or small groups. Naturally,
you start with the ruby
library.
yum install ruby |
You will see the following:
Loaded plugins: langpacks, refresh-packagekit mysql-connectors-community | 2.5 kB 00:00 mysql-tools-community | 2.5 kB 00:00 mysql56-community | 2.5 kB 00:00 pgdg93 | 3.6 kB 00:00 updates/20/x86_64/metalink … |
Everything seemed complete after configuring my standalone MySQL instance to a LAMP
installation, but last night I started playing with the image
files. It turns out that I failed to install the
php-gd
library.
There’s very little feedback when you try to troubleshoot why you
can’t read an image. In fact, the error message for reading the
BLOB
from MySQL was only available on the local
Firefox browser:
The image "http://localhost/ConvertMySQLBlobToImage.php" cannot be displayed because it contains errors. |
The fix requires root
to install the
php-gd
library with the yum
utility:
yum install php-gd |
You’ll need to answer …
[Read more]