Page 1 of 1

APPLICATION ERROR #401 when upgrading from 1.05 to 1.2.0

Posted: 11 Mar 2011, 03:48
by tg.chen
Hi,

I am trying to upgarding from v1.05 to 1.2.0.

After ran query, I got error message as below.

APPLICATION ERROR #401
Database query failed. Error received from database was #1292: Incorrect datetime value: '1299814211' for column 'last_visit' at row 1 for the query: UPDATE mantis_user_table
SET last_visit= ?
WHERE id=?.

I am using win2003 std, php5.3.5, apache2.2.17 and mysql5.0.
I set timezone in config_inc.php

I changed my php.ini setting as http://www.mantisbt.org/bugs/view.php?id=11759. But it didn't work.
Also update mantis_user_table as UPDATE mantis_user_table SET last_visit= '2011-03-11 11:06:52' WHERE id='1'
as according to http://www.mantisbt.org/forums/viewtopi ... =3&t=10328. But no luck.

in core/user_api.php, line no# 1148, it showed as db_query_bound( $query, Array( $c_value, $c_user_id ) );

If you have any idea, please reply me. Thank you.

Re: APPLICATION ERROR #401 when upgrading from 1.05 to 1.2.0

Posted: 13 Mar 2011, 11:52
by atrol
tg.chen wrote: I am trying to upgarding from v1.05 to 1.2.0.
You should upgrade to latest stable version (1.2.4 at the moment)

Re: APPLICATION ERROR #401 when upgrading from 1.05 to 1.2.0

Posted: 09 Feb 2018, 14:52
by marmot
Hello,

I was attempting an upgrade from a very old mantis version (1.1.6) to the latest and greatest stable version (2.11.0) and was getting the same error.

Here's what I've done:
- installed mantis from scratch and entered my database information into config/config_inc.php
- went to the update script at http://yoursite/mantisbt-NEW/admin/install.php, however I receive the following error:

APPLICATION ERROR #401
Database query failed. Error received from database was #1292: Incorrect datetime value: '1518184080' for column 'last_visit' at row 1 for the query: UPDATE mantis_user_table SET last_visit=? WHERE id=?.
Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section.


- I adjust the schema of the mantis_user_table and change the type from datetime to varchar(25) for last_visit
- went to the update script at http://yoursite/mantisbt-NEW/admin/install.php works now
- I choose the option to print the SQL queries instead of writing to the database
- When running the script manually, it exists out after this:

--------------
ALTER TABLE mantis_bug_revision_table ADD INDEX idx_bug_rev_id_time (bug_id, timestamp)
--------------

ERROR 1061 (42000) at line 191: Duplicate key name 'idx_bug_rev_id_time'

- Continued running through all of the SQL update commands (skipping ALTER TABLE mantis_bug_revision_table ADD INDEX idx_bug_rev_id_time (bug_id, timestamp))

- Script errored out again with:
--------------
correct_multiselect_custom_fields_db_format
--------------
ERROR 1064 (42000) at line 19: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'correct_multiselect_custom_fields_db_format' at line 1

- I skipped it and kept running through the script, which errored out again at:
--------------
stored_filter_migrate
--------------
ERROR 1064 (42000) at line 13: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'stored_filter_migrate' at line 1

- I skipped that and it errors out here:
--------------
INSERT INTO mantis_config_table ( value, type, access_reqd, config_id, project_id, user_id ) VALUES ('209', 1, 90, 'database_version', 0, 0 )
--------------

ERROR 1062 (23000) at line 35: Duplicate entry 'database_version-0-0' for key 'PRIMARY'


- That was the last sql statement in the update script. After this, mantis seems to be working and I'm able to view issues without problems. But what can I do about this error: ERROR 1061 (42000) at line 191: Duplicate key name 'idx_bug_rev_id_time'

My fear is that performance might be impacted if this index isn't setup properly - how can I be sure? Additionally, I don't really know what the stored procedures in the upgrade script were supposed to do, but as you can see from my message above, I had to skip all of them because they were erroring out.



Thanks

Re: APPLICATION ERROR #401 when upgrading from 1.05 to 1.2.0

Posted: 09 Feb 2018, 15:01
by atrol
marmot wrote: 09 Feb 2018, 14:52 Here's what I've done:
- installed mantis from scratch
I stopped reading, after reading this.
You must not install Mantis from scratch as this creates a new empty database with latest database schema.
You have to start with your old database schema and your old data.
The installer will change the database schema and the data in it.

Re: APPLICATION ERROR #401 when upgrading from 1.05 to 1.2.0

Posted: 09 Feb 2018, 15:09
by marmot
Wow, that was a fast response! To be more clear, I downloaded the tarball, extracted it into the docroot, modified the config to point to my existing database. I did not set it up on a new database first and then try to import my data.
atrol wrote: 09 Feb 2018, 15:01 You must not install Mantis from scratch as this creates a new empty database with latest database schema.
You have to start with your old database schema and your old data.
The installer will change the database schema and the data in it.

Re: APPLICATION ERROR #401 when upgrading from 1.05 to 1.2.0

Posted: 09 Feb 2018, 16:15
by atrol
marmot wrote: 09 Feb 2018, 14:52 however I receive the following error:

APPLICATION ERROR #401
Database query failed. Error received from database was #1292: Incorrect datetime value: '1518184080' for column 'last_visit' at row 1 for the query: UPDATE mantis_user_table SET last_visit=? WHERE id=?.
Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section.
When do you get this error?
During the upgrade or after the upgrade when trying to access the first page?
marmot wrote: 09 Feb 2018, 14:52- I adjust the schema of the mantis_user_table and change the type from datetime to varchar(25) for last_visit
That's wrong. Don't change any column type yourself. The type is changed by the installer to the right type. I would expect it's int(10) if all goes right.
marmot wrote: 09 Feb 2018, 14:52- I choose the option to print the SQL queries instead of writing to the database
- When running the script manually, it exists out after this:
Can't work. The upgrade process does more than what you see when printing the SQL-Queries, e.g. the date conversion is done by PHP functions.
I recommend to start from scratch with your old database, keep the option to print the queries disabled and run the installer.
In best case, that's it.

Re: APPLICATION ERROR #401 when upgrading from 1.05 to 1.2.0

Posted: 09 Feb 2018, 17:45
by marmot
atrol wrote: 09 Feb 2018, 16:15
marmot wrote: 09 Feb 2018, 14:52 however I receive the following error:

APPLICATION ERROR #401
Database query failed. Error received from database was #1292: Incorrect datetime value: '1518184080' for column 'last_visit' at row 1 for the query: UPDATE mantis_user_table SET last_visit=? WHERE id=?.
Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section.
When do you get this error?
During the upgrade or after the upgrade when trying to access the first page?
I receive that error when trying to access the first page (install.php), just after after extracting the mantis tarball and pointing the config file to my database. I understand the installer is supposed to make that change for me, however since I can't reach the installer without making that schema change first, I didn't really have a choice. I'm practicing this upgrade with a dev copy of the database, so it's easy for me to start over for a 3rd time - but I keep running into this same issue.

Is there maybe a more appropriate upgrade path? 1.1.6 to 2.11 is a big jump. I couldn't find anything in the documentation specific to my use case, but do I need to try doing the upgrade in stages and not jump all the way to version 2.11?

Re: APPLICATION ERROR #401 when upgrading from 1.05 to 1.2.0

Posted: 09 Feb 2018, 19:21
by atrol
Quite interesting, I didn't see this before.
I don't have time at the moment to install an old 1.1.x and to try it myself, but I have a certain idea what could cause this.

Can you try deleting cookies before running the installer?

Re: APPLICATION ERROR #401 when upgrading from 1.05 to 1.2.0

Posted: 09 Feb 2018, 21:55
by marmot
While I was waiting for your response, I tried to access the setup page via Incognito and it worked -- you were spot on, it was an issue with cookies. After this 3rd attempt, it seems to have taken the upgrade script and didn't give me any errors! Issue is solved. Thank you for the assistance!
atrol wrote: 09 Feb 2018, 19:21 Quite interesting, I didn't see this before.
I don't have time at the moment to install an old 1.1.x and to try it myself, but I have a certain idea what could cause this.

Can you try deleting cookies before running the installer?