It is an error which drive me crazy couple of times. It's easy to fix - but hard to detect why happening. I didn't see any good explanation which fits to each single situation I needed to handle it. There are couple of popular theories on what causes the "jtablesession::Store Failed - DB function failed with error" type of errors, but sincerely I can not confirm any of them:
- Flooding (Check your http access logs for access IP’s, and your PHP error logs). Solution: Try dropping the time out down temporally to a lower value, to see if the sessions clear or not.
- SEF If your site has a lot of visitors table jos_session can accumulate substantial overhead. And if you use default SEF, some 404 pages can make some bots to enter into loop, and those bots gives you a huge session overhead.
- Site statistics from within Joomla. Enabling statistics through your site configuration just adds extra MySQL queries and increases server loads.
Before to tell you about the fix: stay cool, probably your site isn't hacked and the database it is in place... else you will get another, nastier error
So what's the direct cause? For whatever reason your 'jos_session' table is damaged. Since this table holds only volatile info about your user's sessions - and nothing recent, since they are seeing the same error, just like you - it is safe to apply one of following recipes:
a. the lancet (I mean the elegant solution)
Go to phpMyAdmin in your hosting panel (should be there, it's a must have tool for a LAMP site), select your database, select the 'jos_session' table (or the one with the right prefix for your site) by clicking on the checkbox in the front of the table name, go to the bottom of the table, and click the arrow on the drop-down box which says "With selected:" and then click on "repair table". This will repair the jos_session table and more importantly repair your Joomla site. You will no longer see: "jtablesession::store failed DB function failed with error number 1062".
b. the big hammer (smash it!)
You don't necessarily need for this phpMyadmin, it's good any known method to run queries against your database (for command-line gurus for example MySQL command line interface also will do the job.
Drop the 'jos_session' table, and re-create it! How? Use this SQL query for example:
DROP TABLE `jos_session`; CREATE TABLE `jos_session` ( `username` varchar(150) default '', `time` varchar(14) default '', `session_id` varchar(200) NOT NULL default '0', `guest` tinyint(4) default '1', `userid` int(11) default '0', `usertype` varchar(50) default '', `gid` tinyint(3) unsigned NOT NULL default '0', `client_id` tinyint(3) unsigned NOT NULL default '0', `data` longtext, PRIMARY KEY (`session_id`(64)), KEY `whosonline` (`guest`,`usertype`), KEY `userid` (`userid`), KEY `time` (`time`) ) TYPE=MyISAM CHARACTER SET `utf8`;
Less elegant, but does the same job. Ah, don't forget to backup everything first, and use the correct Joomla table prefix you have set when you installed the site! If you forgot it, you will easily find this from the configuration.php in this line:
var $dbprefix = 'jos_';