Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

errors inserting to the database #1436

Closed
jameseck opened this issue Dec 3, 2016 · 17 comments
Closed

errors inserting to the database #1436

jameseck opened this issue Dec 3, 2016 · 17 comments
Labels
database issues specific to databases
Milestone

Comments

@jameseck
Copy link

jameseck commented Dec 3, 2016

  • Ampache version: 3.8.2
  • Web server + version: Nginx 1.10 + PHP 5.6.28
  • Server operating system: Alpine
  • Client operating system: NA

Hi,

I'm having a problem trying to create a catalog from a bunch of mp3 albums. I have enabled debug logging in ampache and see the following repeated over and over again:

2016-12-03 15:03:46 [ampache] (Dba) -> Error: ["HY000",1366,"Incorrect string value: '\xFF\xFED\x00o\x00...' for column 'name' at row 1"]
2016-12-03 15:03:46 [ampache] (Dba) -> Error: ["HY000",1366,"Incorrect string value: '\xFF\xFEG\x00o\x00...' for column 'name' at row 1"]
2016-12-03 15:03:46 [ampache] (Dba) -> Error: ["HY000",1366,"Incorrect string value: '\xFF\xFEG\x00o\x00...' for column 'name' at row 1"]
2016-12-03 15:03:46 [ampache] (Dba) -> Error: ["HY000",1366,"Incorrect string value: '\xFF\xFEG\x00o\x00...' for column 'name' at row 1"]
2016-12-03 15:03:46 [ampache] (Dba) -> Error: ["HY000",1366,"Incorrect string value: '\xFF\xFEG\x00o\x00...' for column 'name' at row 1"]

I've checked the mysql db charset and collate settings and they are:

mysql> SELECT DEFAULT_CHARACTER_SET_NAME, DEFAULT_COLLATION_NAME
-> FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = 'ampache';
+----------------------------+------------------------+
| DEFAULT_CHARACTER_SET_NAME | DEFAULT_COLLATION_NAME |
+----------------------------+------------------------+
| utf8 | utf8_unicode_ci |
+----------------------------+------------------------+
1 row in set (0.00 sec)

The tables also have the appropriate utf8 params.

Can anyone help me to work out where I've gone wrong here?

Thanks

J

@wagnered
Copy link
Contributor

wagnered commented Dec 3, 2016 via email

@jameseck
Copy link
Author

jameseck commented Dec 3, 2016

Hi,
Alpine is Linux-based. I have checked and I do have the mbstring extention loaded.
I should also point out that I've tried this with PHP 5.6 and PHP 7.0 and the result is the same.

Thanks
J

@wagnered
Copy link
Contributor

wagnered commented Dec 3, 2016 via email

@jameseck
Copy link
Author

jameseck commented Dec 3, 2016 via email

@wagnered
Copy link
Contributor

wagnered commented Dec 4, 2016 via email

@wagnered
Copy link
Contributor

wagnered commented Dec 4, 2016 via email

@jameseck
Copy link
Author

jameseck commented Dec 4, 2016 via email

@wagnered
Copy link
Contributor

wagnered commented Dec 4, 2016

For me there is output and the same error for both php-5.6 and 7.0. There is a bug in line 51 which I may put in a pull request, but there seems to be another problem with the code which I may debug.

Sorry about that.
Even with the bug(s) fixed, it still won't work with PHP-7 as the mysql extension was removed.

There is an undocumented debug level of 6 that displays the data being sent to the database, that might help. Beware, that it adds quite a bit to the log.

@jameseck
Copy link
Author

jameseck commented Dec 4, 2016

Hi thanks for the tip. I've tried setting the debug level to 6, and whilst it gives some more output, none of it is really any further help I feel.

Here is an example:

2016-12-04 19:19:14 [ampache] (Query) -> SELECT id, mbid FROM artist WHERE name LIKE ?
2016-12-04 19:19:14 [ampache] (Dba) -> Database connection...
2016-12-04 19:19:14 [ampache] (Query) -> INSERT INTO artist (name, prefix, mbid) VALUES(?, ?, ?)
2016-12-04 19:19:14 [ampache] (Dba) -> Error: ["HY000",1366,"Incorrect string value: '\xFF\xFEJ\x00e\x00...' for column 'name' at row 1"]
2016-12-04 19:19:14 [ampache] (Dba) -> Database disconnection.
2016-12-04 19:19:14 [ampache] (Dba) -> Database connection...
2016-12-04 19:19:14 [ampache] (Dba) -> Error: ["HY000",1366,"Incorrect string value: '\xFF\xFEJ\x00e\x00...' for column 'name' at row 1"]
2016-12-04 19:19:14 [ampache] (Dba) -> Database disconnection.
2016-12-04 19:19:14 [ampache] (Dba) -> Database connection...
2016-12-04 19:19:14 [ampache] (Dba) -> Error: ["HY000",1366,"Incorrect string value: '\xFF\xFEJ\x00e\x00...' for column 'name' at row 1"]
2016-12-04 19:19:14 [ampache] (Dba) -> Database disconnection.
2016-12-04 19:19:14 [ampache] (Dba) -> Database connection...
2016-12-04 19:19:14 [ampache] (Dba) -> Error: ["HY000",1366,"Incorrect string value: '\xFF\xFEJ\x00e\x00...' for column 'name' at row 1"]
2016-12-04 19:19:14 [ampache] (Dba) -> Database disconnection.

@wagnered
Copy link
Contributor

wagnered commented Dec 4, 2016 via email

@wagnered
Copy link
Contributor

wagnered commented Dec 5, 2016 via email

@jameseck
Copy link
Author

I use Tag&Rename to set the tags in my mp3s. This can either save the tags as ascii or unicode. It looks like it uses UTF16 and there is no option for anything else.
I have it set to save all tags are unicode, which are then UTF16.
I picked a single mp3 to test with and ampache failed to add this to the catalog with the errors previously provided in this issue.
I found taglib-ruby and whipped up a quick script to verify this. The tags are indeed saved as UTF16.
I then used taglib-ruby to change all the tags in this file to UTF8 and ran the update_catalog.inc script. This time, ampache added it to the database correctly and it's available for playing.

I have been trying to get all of this to work in my docker image for ampache available at https://github.com/jameseck/docker-ampache/

The docker-compose file creates a mysql container as well as the ampache one. It's a bit rough and ready and there are things that don't work, but I'd appreciate it if anyone is able to take a look and advise on why this isn't working as expected.

J

@jameseck
Copy link
Author

I should also add that I had previously tried https://github.com/ampache/ampache-docker and this seemed to pick up all files in my catalog correctly, so it's likely that something in my docker image is wrong, but I have no idea what.

@wagnered
Copy link
Contributor

wagnered commented Dec 10, 2016 via email

@Phyks
Copy link
Member

Phyks commented Jan 5, 2017

@lachlan-00 lachlan-00 added the stale Issues not updated in over a year label Jul 19, 2019
@lachlan-00 lachlan-00 added this to the 5.0.0 milestone Feb 16, 2021
@lachlan-00 lachlan-00 added database issues specific to databases and removed support waiting labels Feb 16, 2021
@lachlan-00
Copy link
Member

default collation is going to change on the database so i'll close this issue when develop makes that change.

@lachlan-00
Copy link
Member

default collation has changed in the develop branch and can be changed with bin/cli run:updateDb -x

@mitchray mitchray removed the stale Issues not updated in over a year label Nov 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
database issues specific to databases
Projects
No open projects
Ampache-master
  
Awaiting triage
Development

No branches or pull requests

5 participants