"Database exception" - help / #1272

Database exception - what's next

Generally speaking there are three reasons for this:
  • the database has been screwed up (quiet common)
  • an invalid SQL-query has been sent (occurs seldom in stable versions)
  • database versions does not match and should be updated
The first step is finding out more.

Database not available?

If you even can't login any more. The database is not available. Use phpmysql or other tools to check your server.

Available but problems? - Get more details

If this is only a problem of a special page inside streber or is not reproducable this could be a SQL-problem. We need to find out more...
  1. log in as project manager or admin
  2. click on system info in the footer
  3. click on error.log : Parse
  4. go to the end of the list and look for the error-message like 20060616001505 ERROR: db/db.inc.php:38 - Datenbankfehler (hide)
  5. click on the date-number at the left for details
The details could look this this:

from errors.log

Error 20060616002056 ERROR:        db/db.inc.php :  38 Datenbankfehler
Error 20060616002056                 db/db.inc.php : 249 -> MysqlException::__construct("Querry=SELECT p.* from project")
Error 20060616002056       db/class_person.inc.php : 734 -> DB_MysqlStatement::execute("", int1)
Error 20060616002056                     index.php : 304 -> Person::getProjects()
Error 20060616002056 
Error 20060616002056      Variables in __construct():
Error 20060616002056                       message = Querry=SELECT p.* from project p, projectperson pp
Error 20060616002056                 WHERE
Error 20060616002056                        p.status <= 5
Error 20060616002056                    AND p.status >= 2
Error 20060616002056                    AND p.state = 1
Error 20060616002056 
Error 20060616002056                    AND pp.person = 11
Error 20060616002056                    AND pp.project = p.id
Error 20060616002056                    AND pp.state=1
Error 20060616002056                 ORDER BY prio, name
Error 20060616002056 
Error 20060616002056                          code = NULL
Error 20060616002056                       sql_obj = Object id #21
Error 20060616002056                   mysql_error = Can't open file: 'project.MYI' (errno: 145)
Error 20060616002056    v0.0621, from 84.190.17.16,  uri:/
Error 20060616002056 

Especially interessting is the line starting with mysql_error =:

mysql_error = Can't open file: 'project.MYI'

tells us, that the sql-table index-files are missing. To fix this use mysqladmin to repair sql-tables. In all cases this fixed the problem for me.

mysql_error = Incorrect key file for table 'project'; try to repair it

tells us, that the sql-table index-files are missing. To fix this use mysqladmin to repair sql-tables. In all cases this fixed the problem for me.

Other errors

This might be a programming error. But before reporting this...
  1. check you version (at the bottom of the error-report) maybe there is a fix outside.
  2. search the tracker for a detail of the report (e.g. class_person.inc.php) to find similar posts.

Report Bugs

Submitting bugs will help us! Please do. But you should read How to submit Bugs before doing so. Please do not add comments if you actually want to add bug reports.

9 Comments

guest

Jan 10, 2007
Error when adding new Project
Error log:
mysql_error = Out of range value adjusted for column 'settings' at row 1

I just click on Submit buttom.

pixtur

Jan 11, 2007
Reply to Error when adding new Project
Please post a valid bug report with the end of error.log.php as described in How to submit Bugs .


guest

Jan 23, 2007
Error when adding new Task
Error log:

message = Querry=INSERT INTO streb_task(...,completion,...) VALUES(...,'0000-00-00 00:00:00',...)

mysql_error = Data truncated for column 'completion' at row 1

guest

Feb 23, 2007
Error after klick on install/upgrade
When I try to install streber the installpage means all o.k. but after klick the install bottom I get the following message.

Proceeding...

Fatal error: Declaration of sql_class::__construct() must be compatible with that of sql_interface::__construct() in H:xampphtdocsstreberdbdb_mysql_class.php on line 37

My System (xampp)

PHP 5.2.0
MySql 5.0.27

pixtur

Feb 24, 2007
Reply to Error after klick on install/upgrade
which version of Streber do you use?

guest

Apr 18, 2007
error on add effort for a developer
Error 20070418091349 ERROR: db/db.inc.php : 39 Database exception. Please read <a href=http://streber.pixtur.de/index.php?go=taskView&tsk=1272'> next steps on database errors.</a>
Error 20070418091349 db/db.inc.php : 251 -> MysqlException::__construct("Querry=SELECT DISTINCT i.*, e.")
Error 20070418091349 db/class_effort.inc.php : 319 -> DB_MysqlStatement::execute("", int1)
Error 20070418091349 pages/project_more.inc.php :1576 -> Effort::getAll([2])
Error 20070418091349 std/class_pagehandler.inc.php : 719 -> ProjViewEfforts()
Error 20070418091349 index.php : 212 -> PageHandler::show("projViewEfforts")
Error 20070418091349
Error 20070418091349 Variables in __construct():
Error 20070418091349 message = Querry=SELECT DISTINCT i., e. from item i, effort e, project p, projectperson upp^M
Error 20070418091349 WHERE^M
Error 20070418091349 i.type = '8'^M
Error 20070418091349 AND i.project=2^M
Error 20070418091349 AND upp.person = 5^M
Error 20070418091349 AND upp.project=2^M
Error 20070418091349 ^M
Error 20070418091349 AND i.state=1^M
Error 20070418091349 AND ( i.pub_level >= upp.level_view^M
Error 20070418091349 OR^M
Error 20070418091349 i.created_by = 5^M
Error 20070418091349 )^M
Error 20070418091349 AND i.project = p.id^M
Error 20070418091349 ^M
Error 20070418091349 AND i.id = e.id^M
Error 20070418091349 ^M
Error 20070418091349 ^M
Error 20070418091349 ^M
Error 20070418091349 ^M
Error 20070418091349 ^M
Error 20070418091349 ^M
Error 20070418091349 ^M
Error 20070418091349
Error 20070418091349
Error 20070418091349 code = NULL
Error 20070418091349 sql_obj = OBJECT
Error 20070418091349 mysql_error = Can't create/write to file '/tmp/#sql_2b0f_0.MYI' (Errcode: 13)
Error 20070418091349 v0.0795, projViewEfforts, from 127.0.0.1, uri:/streber/index.php?go=projViewEfforts&prj=2
Error 20070418091349

php: 5.1.6 mysql: 5.0.27 - fedora 6

pixtur

Apr 19, 2007
hmm.
Looks like you hard disk is full or something like this. If mysql cannot create files like "/tmp" this is probably not the best thing to happen.

guest

Jun 4, 2008
Same Problem
Hi Pixtur I have the same problem my errors.log.php show me the same problem in the line mysql_error =:


mysql_error = Can't create/write to file 'C:\xampp\mysql\data\#sql_9ec_0.MYI' (Errcode: 13)

I check the rights in the folder and all looks fine, what can you thing is it?

In advance regards


jtanen

Jun 6, 2008
Fatal Exception with $ in password
I hit a problem using a password for the database account that had a special character (in this case, a $).

Apparently, according to errors.log.php, the system parsed it incorrectly, declared the variable undefined, and tried to connect with NO password, and failed out. For now, I simply removed special characters from the password and it seems to work.

This was a duh moment on my side, of course, since it makes sense that the PHP would fail out on a $. Figured it was worth noting on here, though.
 

Comment / Update