Author Topic: Could not save contact address  (Read 4782 times)

Offline adrianleigh

  • Newbie
  • *
  • Posts: 1
Could not save contact address
« on: November 21, 2007, 05:51:27 AM »
Hi,

I have recently installed roundcube on iis 6 with mysql but when the users click the + sign to add the contact it gives this message.
Could not save contact address.
I have done loads of searches on teh forum but just cant find the anwser.
I did wonder if it was a file permission thing but i have installed as of the manual.

Any help would be great.

Cheers Ady

Offline yitbos

  • Newbie
  • *
  • Posts: 8
Re: Could not save contact address
« Reply #1 on: January 17, 2008, 11:14:58 AM »
Hi...Were you able to solve this ? I am having the same problem...Thanks

Offline daz

  • Newbie
  • *
  • Posts: 2
Re: Could not save contact address
« Reply #2 on: February 14, 2008, 07:36:18 PM »
Check your log files for roundcube. You are looking for /logs/errors. I had this problem and my error looked like this:

[14-Feb-2008 16:55:54 -0700] DB Error: DB Error: unknown error Query: INSERT INTO contacts (user_id, changed, del, `name`, `email`) VALUES ('3', now(), 0, 'Info', 'info@xxxx.com.au') [nativecode=1364 ** Field 'firstname' doesn't have a default value] in C:\Inetpub\Webmail\roundcubemail-0.1-rc2\program\include\rcube_db.inc on line 505
[14-Feb-2008 16:57:34 -0700] DB Error: DB Error: unknown error Query: INSERT INTO contacts (user_id, changed, del, `name`, `email`) VALUES ('3', now(), 0, 'Info', 'info@xxxx.com.au') [nativecode=1364 ** Field 'firstname' doesn't have a default value] in C:\Inetpub\Webmail\roundcubemail-0.1-rc2\program\include\rcube_db.inc on line 505
[14-Feb-2008 16:57:36 -0700] DB Error: DB Error: unknown error Query: INSERT INTO contacts (user_id, changed, del, `name`, `email`) VALUES ('3', now(), 0, 'Info', 'info@xxxx.com.au') [nativecode=1364 ** Field 'firstname' doesn't have a default value] in C:\Inetpub\Webmail\roundcubemail-0.1-rc2\program\include\rcube_db.inc on line 505

The problem was caused by MySQL running in strict mode, which means the db will reject any query that tries to insert an empty value into a NOTNULL field. When you click the [ + ], there is no way to set the 'firstname' field, so roundcube leaves it blank, causing problems with a strict db. I believe this mainly affects MySQL 5 (which I am running) as strict mode was only introduced in 5.0.2.

How To Fix:
- Open my.cnf or my.ini depending on your installation
- Look for the following lines:
Code: [Select]
# Set the SQL mode to strict
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
- Remove any instance of 'STRICT_TRANS_TABLES' or 'STRICT_ALL_TABLES' from the 'sql-mode' parameter
- Restart the MySQL service

This should fix the same problem on nix boxes too.

Offline methilnet

  • Jr. Member
  • **
  • Posts: 16
Re: Could not save contact address
« Reply #3 on: March 04, 2008, 12:47:19 PM »
Fix the database dont break the server!
Set the field to allow null value instead.
Learn to deal with strick_mode that how SQL is suppose to work.
Why set a field to NotNull if you are not going to put a value in it anyway?

Offline methilnet

  • Jr. Member
  • **
  • Posts: 16
Re: Could not save contact address
« Reply #4 on: March 04, 2008, 01:14:51 PM »
Here is the script to fix the identities table


ALTER TABLE `identities` MODIFY COLUMN `organization` VARCHAR(128) CHARACTER SET utf8 COLLATE utf8_general_ci,
 MODIFY COLUMN `reply-to` VARCHAR(128) CHARACTER SET utf8 COLLATE utf8_general_ci,
 MODIFY COLUMN `bcc` VARCHAR(128) CHARACTER SET utf8 COLLATE utf8_general_ci,
 MODIFY COLUMN `signature` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci,
 MODIFY COLUMN `html_signature` TINYINT(1);


And the one for the contacts table


ALTER TABLE `contacts` MODIFY COLUMN `firstname` VARCHAR(128) CHARACTER SET utf8 COLLATE utf8_general_ci,
 MODIFY COLUMN `surname` VARCHAR(128) CHARACTER SET utf8 COLLATE utf8_general_ci,
 MODIFY COLUMN `vcard` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci;


Offline kait-ahoi

  • Newbie
  • *
  • Posts: 1
Re: Could not save contact address in Lion Server webmail
« Reply #5 on: August 21, 2012, 05:00:37 AM »
When I try to fix the webmail with command listed in forum Terminal says
could not save history to file "/var/empty/.psql_history": Permission denied
Can anybody help on this