Home | Features | Demo | Downloads | About Us | Support | Purchase

MySQL Null Null Error

Not long ago I got an email from a customer having a strange problem with his store. Whenever someone checked a box to remove an item from the shopping cart, the store would throw an error. Reviewing the error dump showed a strange null null error. We've seen this in ColdFusion for some time but in the past, they are usually not very reproducible unless there's an error in the code causing a null value. On review though, we could not find anything causing it, the code and all queries involved didn't show any null values anywhere.

We did a fair amount of detective work trying to find the cause, and I tried multiple ways to code around it, but the best I could achieve was to reduce the frequency that the error occurred. There was simply no way to do the function without that update being in there at some point and the database continued to routinely dump a null error when it got to it. We updated ColdFusion to version 9 to see if that helped, and tried a different MySQL connector as well, with no luck.

Finally, we decided to upgrade the MySQL to the latest version. It was already on a fairly recent release, but there didn't seem to be any other possible cause for it. And bingo, the error is gone! We're not sure exactly what MySQL was having an issue with, but it does seem this recalculation error is due to some bug in MySQL.

So if you run across this error, try updating the MySQL version and that should take care of it. We have seen the error in a couple different 5.1.3x versions and it does not seem to occur in 5.1.4x.

Do You Backup Your Database?

You'll probably read this entry title and think, sure, I have my host run daily backups of all my databases. But what happens if there is a major problem and you can't get to those backups? I've had so many problems with web hosts over my many, many years of running websites, and have learned not to ever trust my files solely to them. Recently, my host ran a network-wide upgrade of their virtualization software. Something was wrong with the kernel and the result was that all the boxes came down...and day after day went by with all of them still inaccessible. Thankfully, I use Navicat to run a daily backup of all my cfwebstore databases, which is saved down to my local system automatically each night. My sites as well are all backed up locally, so it was fairly easy to get everything moved to a new host and get up again quickly.

It's something to consider if the cost of being down for any amount of time would be devastating to you. There are a variety of ways to grab backups of your databases regularly. If you use Access, you can use an FTP program like CuteFTP that will automatically grab copies of files on a scheduled basis. If you use MySQL, Navicat as I mentioned can do backups and data syncs, MySQLYog Enterprise can do this as well. For MS SQL you can usually request your host to place a copy in an FTP location for you to get each day (if you don't have full access to the box yourself). It's something you may want to consider, if only for the piece of mind of knowing that you have full access to a recent copy of your data at all times.

As for me, well this has been a tough year so far with all my hardware issues, and this week has been worse than most dealing with sites and email being down and having to move again to a new host. I just am keeping my fingers crossed that things will get better from here!

My Love Affair with MySQL

For many years, I did the bulk of my development on Access. It was quick and easy to develop on and with the Upsizing Wizard, I could easily upscale it to SQL server when needed. I ran the cfwebstore.com website and demos on it as well, and appreciated how easy it was when I needed to move my sites....just grab a copy of the database and move it over to the new server.

As CFWebstore grew and became more database-intensive, I've definitely found myself moving further and further away from Access. As my site got busier, it started to have more problems, with timeouts and failures happening often on a daily basis. As I've needed more control over things like indexes and foreign key names, I've gotten to appreciate how well-hidden Access keeps such things. Upscaling doesn't always work properly, and trying to write scripts to upgrade Access databases were an incredible pain due to its failure to handle scripts. Security as well is more of an issue, requiring me to set up an separate location for my Access files and password-protecting them.

But neither was my site busy enough to really warrant moving to a SQL Server plan which is often a pricey option. SQL Server Express is becoming more common but still somewhat limited. I needed an option that was cheap, but more robust than Access. Enter MySQL.

[More]

 
BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.