Bug 174269 - import of amarok 1.4 mysql db fails
Summary: import of amarok 1.4 mysql db fails
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: Collections/Local (show other bugs)
Version: 2.1.1
Platform: Ubuntu Linux
: HI crash
Target Milestone: ---
Assignee: Amarok Developers
URL:
Keywords:
: 190200 204289 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-11-04 17:14 UTC by Matthias Adrian Mendler
Modified: 2009-12-09 11:34 UTC (History)
27 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Addresses the possibility that there may not be a valid database (1.10 KB, patch)
2008-12-09 18:28 UTC, Erik Hovland
Details
avoids crash and provides more debugging for 0 tracks imported (2.60 KB, patch)
2008-12-12 18:28 UTC, Erik Hovland
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Adrian Mendler 2008-11-04 17:14:25 UTC
Version:            (using KDE 4.1.2)
Compiler:           deb package from from http://ppa.launchpad.net/kubuntu-members-kde4/ubuntu intrepid (amarok-kde4 - 1.94-0ubuntu1~ppa1)
OS:                Linux
Installed from:    Ubuntu Packages

My mysql-server's version is 5.0.67

When I try to import my amarok 1.4 collection from mysql ('amarokdb') it says:
Error: Could not open Amarok 1.4 database: Unknown database 'amarokdb' QMYSQL: Unable to connect
Failed: Unable to import statistics

The username is root, my password is correct, there is a database called amarokdb, hostname is localhost.

I accidentally told him to import the (non-existent) db "amarok" - and it says:
Success: Imported 0 tracks
This db existed before, but I deleted it and restarted mysql (and deleted ~/.kde/share/apps/amarok and ~/.kde/share/config/amarok*).

So I tried another db-name "qwert" that never existed, with the result, that amarok crashes.
The crash handler tells me this:
http://www.nopaste.com/p/aA5zcc2Md

I can reproduce all the three bugs. (i tried some other never existing once, too, like "asd", "asdasd"...same reaction.)
Comment 1 Matthias Adrian Mendler 2008-11-04 17:16:15 UTC
Oh, and that's what the terminal says when I try to import the (existing) amarokdb:

http://www.nopaste.com/p/aMRUG1LEc
Comment 2 Seb Ruiz 2008-11-04 22:33:37 UTC
Make sure that you can connect to the mysql database using the command line. Something along the lines of:

mysql -U root -h localhost -p amarokdb

If you cannot connect with the mysql tool then there is no way that Amarok is going to be able to.

I'll take a look into the crashes also.
Comment 3 Matthias Adrian Mendler 2008-11-10 22:26:50 UTC
Hi sorry I reply this late...

I can connect with "mysql -u root -h localhost -p amarokdb" - at least I don't get any error messages.

matyy@inquisitor:~$ mysql -u root -h localhost -p amarokdb
Enter password: 
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 53
Server version: 5.0.67-0ubuntu6 (Ubuntu)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>
Comment 4 Marco 2008-11-20 15:00:24 UTC
(In reply to comment #3)
> Hi sorry I reply this late...
> 
> I can connect with "mysql -u root -h localhost -p amarokdb" - at least I don't
> get any error messages.
> 
> matyy@inquisitor:~$ mysql -u root -h localhost -p amarokdb
> Enter password: 
> Reading table information for completion of table and column names
> You can turn off this feature to get a quicker startup with -A
> 
> Welcome to the MySQL monitor.  Commands end with ; or \g.
> Your MySQL connection id is 53
> Server version: 5.0.67-0ubuntu6 (Ubuntu)
> 
> Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
> 
> mysql>
> 

I have the same problem

Comment 5 Marian Kyral 2008-11-29 21:58:41 UTC
I can confirm this bug as well.

Gentoo ~amd64, kde 4.1.80, mysql-5.0.72

amarok-1.98 or amarok compiled from actual svn - the same error

Error: Could not open Amarok 1.4 database: Unknown database 'amarokdb' QMYSQL: Unable to connect
Failed: Unable to import statistics

I found only these interesting lines in terminal
Object::connect: No such signal QComboBox::textChanged(int)
Object::connect:  (sender name:   'kcfg_ExternalBrowser')
Object::connect:  (receiver name: 'settings')
Object::connect: No such signal DatabaseImporter::importFinished()

Object::connect: No such signal DatabaseImporter::importFinished()
QSqlDatabasePrivate::addDatabase: duplicate connection name 'qt_sql_default_connection', old connection removed.


Database exists and is accessible:
----------------------------------
[21:21:59 marian@gool ~]$ mysql -u amarok -p -h localhost -p amarokdb 
Enter password:                                                       
Reading table information for completion of table and column names    
You can turn off this feature to get a quicker startup with -A        

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2                            
Server version: 5.0.70-log Gentoo Linux mysql-5.0.70     

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show tables;
+--------------------+
| Tables_in_amarokdb |
+--------------------+
| admin              | 
| album              | 
| amazon             | 
| artist             | 
| composer           | 
| devices            | 
| directories        | 
| embed              | 
| genre              | 
| images             | 
| labels             | 
| lyrics             | 
| playlists          | 
| podcastchannels    | 
| podcastepisodes    | 
| podcastfolders     | 
| related_artists    | 
| statistics         | 
| tags               | 
| tags_labels        | 
| uniqueid           | 
| year               | 
+--------------------+ 
22 rows in set (0.00 sec)

mysql> select count(1) from album;
+----------+                      
| count(1) |                      
+----------+                      
|      422 |                      
+----------+                      
1 row in set (0.00 sec)           

mysql> exit


Comment 6 Dan Meltzer 2008-12-03 18:28:16 UTC
Targetting this for 2.0 as it looks fairly important.  It may have to wait for 2.0.1, however.
Comment 7 Erik Hovland 2008-12-09 18:28:09 UTC
Created attachment 29184 [details]
Addresses the possibility that there may not be a valid database

Since driverName can return a null QString, it probably should be checked. And then a null QSqlDatabase should be returned in databaseConnection(). This patch does that just in case.
Comment 8 Erik Hovland 2008-12-09 18:31:03 UTC
The original pastebin is from a amarok before I stuck in a bunch of initialization fixes. So it doesn't reflect the current state of amarok. Is it possible for someone to get another backtrace with the latest from trunk? If it still crashes, please try the newly attached patch. I am concerned that we make connection calls on what is a null QSqlDatabase.

BTW, I shortened the conditional for making the connection. But I did that just to save space. If this patch is applied. Feel free to drop that change since it provides nothing for the fix.
Comment 9 Florian Eßer 2008-12-10 17:11:45 UTC
Just installed today's Amarok 2.0 release packages (Kubuntu 8.10, KDE 4.2 beta).

If I try to import my old Amarok 1.4 database from MySQL, the import tool gets stuck at message "Importing downloaded album art".
If I disable album art importing, it sometimes finishes with "Success: Imported 0 tracks", sometimes it just crashes.
Comment 10 Erik Hovland 2008-12-11 02:17:43 UTC
I know this may be asking a lot. But would it be possible to run Amarok in gdb and then try to import. When it gets stuck on "Importing downloaded album art" crash it out and get a backtrace. Otherwise, sending a backtrace to the crashes you see are also helpful.

You get bonus points for trying out the patch attached to this bug to see if it has any effect.
Comment 11 Mark Kretschmann 2008-12-11 08:40:18 UTC
Note that you will have to start amarok in gdb with "run --nofork". Otherwise the output will be useless.

Also, you need to install an Amarok-debug package first.
Comment 12 Thomas Kahle 2008-12-11 11:14:45 UTC
I tried the 2.0 release today and it still has this bug. In my case I have no crashes. It just reports "success, imported 0 tracks" no matter what I enter into this import dialog (existing databases, non-existing, correct password, wrong password, existing users, non-existing users)

connecting to mysql-server via commandline works flawlessly. Amarok 1.4 uses this db. mysql server is 5.0.70.

Can you tell a little more how to get the information you need for debugging this? I'm using gentoo, gdb is here, I know how to compile amarok with "debug use flag" as it is called in gentoo.
So, what do you need ?

Thanks a lot and all the best
Comment 13 Marian Kyral 2008-12-11 11:30:58 UTC
Unfortunately, the debug USE flag has nothing to do with debug symbols :-(

http://www.gentoo.org/proj/en/qa/backtraces.xml
Comment 14 simon 2008-12-12 02:20:10 UTC
hmm, have to step into this line here too, no import possible using mysql telling me just "success, imported 0 tracks"
Comment 15 Florian Eßer 2008-12-12 10:28:33 UTC
OK, I installed Ubuntu package "amarok-kde4-gdb" and ran it in gdb.

First, I tried to import my old collection, when it got stuck at "Importing downloaded album art", I killed it with Ctrl+C and got a backtrace:
http://www.nopaste.com/p/aGhxUB43V

The last thing it said in the console was
"Object::connect: No such signal DatabaseImporter::importFinished()",
so maybe it's just the same problem like "Success: 0 tracks found", but with missing "Success" message?

After that, I tried again with disabled "Import album art"-checkbox.
First, I gave a nonexisting database name ("foobar"). No crash, just a perfectly normal message "Database not exist: foobar" error message.
But, clicking the "back" button and changing the db name to the correct one still produced the very same message with the old database name.
So there's also some little work to do.

Restarting the import tool, this time giving the correct database name and also disabling "Import album art", Amarok crashed: http://www.nopaste.com/p/a9hqD11I5

Ah, and by the way, I have two non-amarok related tables in my amarok database (don't ask why...). This shouldn't be a problem?
Comment 16 Erik Hovland 2008-12-12 18:28:34 UTC
Created attachment 29275 [details]
avoids crash and provides more debugging for 0 tracks imported

Same crash avoidance code. No changes there.

The new code attempts to figure out why we would even need to avoid the crash. Why do we not get the right enum for the database. In the tradition of using a chainsaw when a butter knife would do the new function code attempts to discover the problem at every function call.

Also there should be a print out of every track that is not imported so we can have a better understanding of what the collection manager can't find.
Comment 17 Mark Kretschmann 2008-12-12 19:43:12 UTC
SVN commit 896162 by markey:

New patch from Erik Hovland that attempts to fix the Amarok 1.4 collection
importer.

Please test!

CCBUG: 174269

 M  +18 -1     FastForwardImporterConfig.cpp  
 M  +8 -3      FastForwardWorker.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=896162
Comment 18 Mark Kretschmann 2008-12-15 08:12:15 UTC
A new report from our forum:

<quote>
I had the same problem importing Amarok 1.4 DB that show "Success: Imported 0 tracks" message.
I installed amarok 2.0 (build date: dec 10 2008) from debian experimental repository. My db was in mysql-server 5.0.67-2 at localhost, and id, password, database name was alright when I test with mysql-client.

While I read this thread, I got an idea when Seb Ruiz said...
Quote from: Seb Ruiz on November 24, 2008, 07:13:29 AM
I didn't have any problems running the importer. The database was, however, on another machine.
So I put my real host name in the "Hostname" field of the "Import Collection" dialog, instead of "localhost" which was the default value.
And it worked!
</quote>

Source: http://amarok.kde.org/forum/index.php/topic,15931.msg25042.html#msg25042
Comment 19 simon 2008-12-15 12:08:22 UTC
yeah -

127.0.0.1 instead of localhost did the trick, never thought the dns resolution would be the cause
Comment 20 Mark Kretschmann 2008-12-15 13:02:51 UTC
So, Seb, looks like we finally nailed this bugger down :)
Comment 21 Seb Ruiz 2008-12-15 21:30:35 UTC
wonderful, what an obscure bug. thanks for all the effort. I'll get a fix in by 2.0.1
Comment 22 copong 2009-01-13 01:21:00 UTC
Did the fix get in by 2.0.1.1? Running it in Kubuntu 8.10 and I get the same as previous users.

"localhost" yields "Failed: No tracks were imported"
"127.0.0.1" or my hostname make amarok crash, with this console output:

X Error: BadWindow (invalid Window parameter) 3
  Major opcode: 20 (X_GetProperty)
  Resource id:  0x3801a94
Object::connect: No such signal DatabaseImporter::importFinished()
QSocketNotifier: Invalid socket 50 and type 'Read', disabling...
KCrash: Application 'amarok' crashing...
sock_file=/home/luis/.kde/socket-ordenata/kdeinit4__0
amarok: Fatal IO error: client killed

If I check the "import downloaded album art" thingy in combination with "localhost", it stays there forever, I see no hdd activity and sometimes says it can't copy a particular file (opening said file on gwenview reveals an album cover). Doing the same with either the local loop or my hostname, same crash.

If someone lets me know how to use gdb as if I was thick I can produce a backtrace, amarok-kde4-dbg is already installed.
Comment 23 Bruno Vernay 2009-01-16 23:21:56 UTC
I am using 
 - Fedora 10
 - MySQL 5.0.67
 - KDE 4.1.3
 - Amarok 2.0.1

First I tried with "localhost", it failed but didn' crash, so I tried with "127.0.0.1" and it failed again.
I closed amarok.
I relaunched Amarok and tried directly with "127.0.0.1" ... it worked !

Thanks
Comment 24 Marco 2009-01-17 15:06:37 UTC
(In reply to comment #23)
> I am using 
>  - Fedora 10
>  - MySQL 5.0.67
>  - KDE 4.1.3
>  - Amarok 2.0.1
> 
> First I tried with "localhost", it failed but didn' crash, so I tried with
> "127.0.0.1" and it failed again.
> I closed amarok.
> I relaunched Amarok and tried directly with "127.0.0.1" ... it worked !
> 
> Thanks
> 

This works for me too!!!
Comment 25 Mark Kretschmann 2009-01-18 13:22:25 UTC
@Seb: Is the "localhost" issue already fixed in trunk? Seems pretty simple to fix, no?
Comment 26 Chris 2009-01-18 18:09:53 UTC
I also get the crashes and changing to 127.0.0.1 doesn't seem to matter.

KCrash: Application 'amarok' crashing...
sock_file=/home/chris/.kde/socket-kubuntu-chris/kdeinit4__0
amarok: Fatal IO error: client killed
Comment 27 Seb Ruiz 2009-01-18 22:45:31 UTC
@Mark: It's not currently fixed in trunk -- this is more than anything a workaround which masks the original problem. I'd like to do a little more investigation on the issue before simply doing a switch between localhost and 127.0.0.1. My feeling is that it might be a Qt bug.
Comment 28 Marco 2009-01-19 17:28:02 UTC
(In reply to comment #24)
> (In reply to comment #23)
> > I am using 
> >  - Fedora 10
> >  - MySQL 5.0.67
> >  - KDE 4.1.3
> >  - Amarok 2.0.1
> > 
> > First I tried with "localhost", it failed but didn' crash, so I tried with
> > "127.0.0.1" and it failed again.
> > I closed amarok.
> > I relaunched Amarok and tried directly with "127.0.0.1" ... it worked !
> > 
> > Thanks
> > 
> 
> This works for me too!!!
> 

The importation works, but the music score is all wrong and the album cover import fails! 
Comment 29 Marian Kyral 2009-02-08 17:18:04 UTC
I'm still not able to import my old collection. It not crash, it is doing something, but then No tracks imported. It doesn't matter whether I use localhost or 127.0.0.1, restart Amarok or not. :-(

Kde 4.2 final, Mysql 5.0.72-r1, Amarok 2.0.1.1
Comment 30 Jo Schulze 2009-02-11 23:18:58 UTC
Still the same problem with amarok Version 2.0.1
Using KDE 4.2.00 (KDE 4.2.0) "release 93"
openSUSE 11.1

Using localhost results:
Importing downloaded album art
Failed: No tracks were imported

Using 127.0.0.1:
Error: Could not open Amarok 1.4 database: Can't connect to MySQL server on '127.0.0.1' (111) QMYSQL: Unable to connect
Failed: Unable to import statistics

The MySQL access data are definitly correct.
Comment 31 Nils Gundelach 2009-03-09 16:35:11 UTC
Problem still exists in latest kubuntu jaunty:

Using kde 4.2.1, amarok 2.0.2, mysql 5.1.30

Object::connect: No such signal DatabaseImporter::importFinished() in /build/buildd/amarok-2.0.2mysql5.1.30/amarok-2.0.2/src/databaseimporter/DatabaseImporter.cpp:36

localhost / 127.0.0.1:

Importing downloaded album art
Failed: No tracks were imported
Comment 32 Seb Ruiz 2009-03-10 11:33:29 UTC
SVN commit 937666 by seb:

Replace "localhost" with 127.0.0.1 when importing from Amarok 1.4 mysql
databases.
CCBUG: 174269

 M  +2 -1      DatabaseImporter.cpp  
 M  +7 -1      amarok14/FastForwardImporter.cpp  
 M  +1 -1      amarok14/FastForwardImporterConfig.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=937666
Comment 33 Nils Gundelach 2009-03-12 20:48:55 UTC
doesn't work for me with svn revision 938715 
Connected to MySQL server 5.1.32-embedded



Importing downloaded album art
Failed: No tracks were imported

nothing special in debug mode:

amarok: BEGIN: void DatabaseImporterDialog::pageChanged(KPageWidgetItem*, KPageWidgetItem*)
amarok: BEGIN: void DatabaseImporterDialog::selectImporter()
amarok: END__: void DatabaseImporterDialog::selectImporter() - Took 0.014s
amarok: END__: void DatabaseImporterDialog::pageChanged(KPageWidgetItem*, KPageWidgetItem*) - Took 0.014s
amarok: BEGIN: void DatabaseImporterDialog::pageChanged(KPageWidgetItem*, KPageWidgetItem*)
amarok: BEGIN: virtual void DatabaseImporter::startImporting()
amarok: BEGIN: virtual void FastForwardImporter::import()
amarok: END__: virtual void FastForwardImporter::import() - Took 0.00034s
amarok: BEGIN: virtual void FastForwardWorker::run()
amarok: END__: virtual void DatabaseImporter::startImporting() - Took 0.00064s
amarok: BEGIN: QSqlDatabase FastForwardWorker::databaseConnection()
amarok: END__: void DatabaseImporterDialog::pageChanged(KPageWidgetItem*, KPageWidgetItem*) - Took 0.0011s
amarok: END__: QSqlDatabase FastForwardWorker::databaseConnection() - Took 0.042s
amarok: END__: virtual void FastForwardWorker::run() - Took 0.87s
amarok: BEGIN: void FastForwardImporter::finishUp()
amarok: END__: void FastForwardImporter::finishUp() - Took 0.0011s
Comment 34 kozaki 2009-03-13 17:32:51 UTC
Qt: 4.5.0
KDE: 4.2.1 (KDE 4.2.1)
Amarok: 2.0.2
mysql  Ver 14.14 Distrib 5.1.32, for mandriva-linux-gnu (x86_64) using readline 6.0
Mandriva 2009.1.0 0.5 cooker (2009.1 Spring)
WM used: e17

Can log in amarok Mysql DB with 'localhost' (uname or 127.0.0.1 won't work):
 $ mysql -u root -h localhost -p amarok
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4802
Server version: 5.1.32 Mandriva Linux - MySQL Standard Edition (GPL)
_snip_

mysql> show tables;
+------------------+
| Tables_in_amarok |
+------------------+
| admin            | 
| album            | 
| amazon           | 
| artist           | 
| composer         | 
| devices          | 
| directories      | 
| embed            | 
| genre            | 
| images           | 
| labels           | 
| lyrics           | 
| playlists        | 
| podcastchannels  | 
| podcastepisodes  | 
| podcastfolders   | 
| related_artists  | 
| statistics       | 
| tags             | 
| tags_labels      | 
| uniqueid         | 
| year             | 
+------------------+

Like others here i have tried to import my Amarok 1.4 DB (/me hoping with podcasts!) but with no luck.

First tries, got an error about ('amarok --debug'):

 amarok(31795)/kio (KIOJob) KIO::SlaveInterface::dispatch: error  112   "/home/me/.kde4/share/apps/amarok/albumcovers/large/c75666efdc129f426ab637a818da0523"

Thereafter I deleted ~/.kde4 and launched amarok2 again.
This time looked like everything was goin well (no more error)... but at the end of the import the issues persist with nothing imported :-(
have posted on the forum, post http://amarok.kde.org/forum/index.php/topic,16590.msg26962.html#msg26962

Tried with '127.0.0.1' and system's uname at least 3 times each but this way DB importer simply does not connect to MYSQL.
Comment 35 Nils Gundelach 2009-03-17 23:47:20 UTC
i spent some time on this issue and it looks like my problem is based on a mysql library problem.

i modified amarok/src/databaseimporter/amarok14/FastForwardWorker.cpp to get more debugging information:

QSqlQuery::value: not positioned on a valid record
amarok:    QSqlError(2036, "QMYSQL3: Unable to bind outvalues", "Using unsupported buffer type: 3  (parameter: 3)"
Comment 36 Manuel Amador (Rudd-O) 2009-03-25 21:02:32 UTC
I have the VERY SAME PROBLEM... with PostgreSQL.  Note that an older version of Amarok 2.x DID import my collection, but this 2.0.2 version doesn't.

Screenshot:

http://imagebin.ca/view/oZu-cH.html

note that I cleaned my old configuration completely from the .kde dir, so it's not a problem with the old config.

When is this going to be fixed???  For something as simple as this I would haev figured you would have provided extensive error handling, not a moronic "driver not loaded" error message with no explanation and that's it.

FYI:

~@karen α:
rpm -ql qt-postgresql
/usr/lib64/qt4/plugins/sqldrivers/libqsqlpsql.so
Comment 37 Mark Kretschmann 2009-04-20 19:58:36 UTC
*** Bug 190200 has been marked as a duplicate of this bug. ***
Comment 38 Sergei Andreev 2009-04-20 21:23:39 UTC
I've figured out the root of my problem:
during migration from kubuntu 8.10 to kubuntu 9.04 I've remount partition with music collection files in another way.
was: /media/data/Music/...
became: /media/Data/Music/...

So the data in amarok 1.4 db became incorrect.

I've installed amarok 1.4 from PPA rebuilt collection with proper path and then reinstall amarok 2.1beta

And now amarok had automatically detected and rescanned it without any manually importing.
Comment 39 Myriam Schweingruber 2009-05-15 11:13:52 UTC
*** Bug 190200 has been marked as a duplicate of this bug. ***
Comment 40 Ulrich Lukas 2009-05-16 11:34:41 UTC
Hi,

using latest packages from:
http://amarok.kde.org/wiki/User:Apachelogger/Project_Neon

trying to import the old collection, either with "localhost" or "127.0.0.1" yields:

"Importing downloaded album art"
"Failed: No tracks were imported"

Kubuntu 9.04 AMD64 Linux 2.6.29.3, MySQL 5.0.75-0ubuntu10.2
Comment 41 Matt Sharp 2009-05-21 01:28:14 UTC
I had an error like:

Error: Could not open Amarok 1.4 database: Can't connect to MySQL server on
'127.0.0.1' (111) QMYSQL: Unable to connect

For me, the problem was that I run mysql with "skip_networking".  I commented this out and restarted mysql, and then got a clean import.  It's still a bug (amarok should be able to use unix domain sockets as well as TCP sockets), but this workaround may work for some people.
Comment 42 Mark Kretschmann 2009-05-21 08:54:03 UTC
@Matt: Interesting. Do you know how to fix this from the Amarok side? A patch would be welcome.
Comment 43 Matt Sharp 2009-05-21 09:26:16 UTC
I have never looked at amarok source before, and I don't even know how amarok connects to mysql (ie. using some QT or KDE API, or directly using mysql libs).  Depending on how it's done, this may not be an amarok bug.  I know amarok 1.4 works with unix domain sockets.

My brief understanding of things is that unix domain sockets are used by default if the client asks to connect to "localhost", and this decision is made by the mysql client libraries.  If the client asks to connect to "127.0.0.1" instead, then that forces the connection to be made using TCP.

As I said before, my mysql daemon has "skip_networking" set, which means it only listens to a unix domain socket, and not on a TCP socket.  This illustrates the issue (matt_amarok is the db name):

$ mysql -h localhost matt_amarok -p
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.0.76-log Gentoo Linux mysql-5.0.76-r1

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.



$ mysql -h 127.0.0.1 matt_amarok -p
Enter password:
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)


I'm also working with beta 2 of 2.1 and have never tried 2.0.x
Comment 44 Lukas Jirkovsky 2009-05-21 17:04:28 UTC
Thanks, it partially helped. I also had to add
mysqld : 127.0.0.1 : ALLOW
to my /etc/hosts.allow

But then it works like a charm.
Comment 45 Huseyin 2009-05-24 12:13:50 UTC
ubuntu 9.04
amarok 2:2.0.2mysql5.1.30-0ubuntu3
AMD64
--
hi, I changed "localhost" to 127.0.0.1 in the import menu in amarok. Also changed /etc/hosts.allow (see#44).

Still getting the error:

"Importing downloaded album art"
"Failed: No tracks were imported"

Logging into mysql, I see that skip_networking is set to OFF. Also, in mysql there's no difference in the output, whether I use "127.0.0.1" or "localhost"

------

  :~$ mysql -u amarok -h 127.0.0.1 -p amarok
  Enter password: 
  Reading table information for completion of table and column names
  You can turn off this feature to get a quicker startup with -A 

  Welcome to the MySQL monitor.  Commands end with ; or \g.
  Your MySQL connection id is 4
  Server version: 5.0.75-0ubuntu10 (Ubuntu)

------

 :~$ mysql -u amarok -h localhost -p amarok
  Enter password: 
  Reading table information for completion of table and column names
  You can turn off this feature to get a quicker startup with -A

  Welcome to the MySQL monitor.  Commands end with ; or \g.
  Your MySQL connection id is 5
  Server version: 5.0.75-0ubuntu10 (Ubuntu)

------

If skip_networking is set to OFF, is that correct? Is there something else I can do?
Comment 46 antonio 2009-06-17 00:26:50 UTC
i have the same problem with mysql and the new amarok, please when i would can import my collection, thank you very much for this program and congratulations.
Comment 47 Dan Keenan 2009-06-21 00:57:38 UTC
I have the same issue with Kubuntu 9.04, Amarok 2.1.1, and MySQL 5.0.75, all from the Kubuntu packages.  This is the only reason why I still use 1.4, as I have way too many ratings etc in the database and don't have time to rerate my music.
Comment 48 Julianon 2009-06-21 10:19:53 UTC
Migrate stats from an old database: http://amarok.kde.org/forum/index.php/topic,16966.0.html
Comment 49 copong 2009-06-21 10:30:41 UTC
Thanks for that workaround Julianon, but this won't do it. It's to migrate stats from a 2.x database to a 2.x database.
Comment 50 Julianon 2009-06-21 10:40:06 UTC
(In reply to comment #49)
> Thanks for that workaround Julianon, but this won't do it. It's to migrate
> stats from a 2.x database to a 2.x database.

I successful migrate from 1.4 to 2.1.1. I copy amarok 1.4 database from /var/lib/mysql/amarok and also I change sql sentence:

REPLACE INTO new.statistics
        (url, createdate, accessdate, score, rating, playcount, deleted)
    SELECT nu.id, os.createdate, os.accessdate, os.percentage, os.rating, os.playcounter, os.deleted
        FROM old.statistics os
	inner join new.urls nu on (nu.rpath = os.url);
Comment 51 copong 2009-06-21 10:44:06 UTC
My bad, gotta try that then :)

Still, doesn't solve this bug though, don't want to be a pain but how come this is proving so difficult to fix? Surely core functionality needs sorting out before anything else?
Comment 52 Manuel Amador (Rudd-O) 2009-06-25 21:14:16 UTC
doesnt solve my bug either.  my bug is that stats from files outside the collection are not imported.  this is a pretty major bug.
Comment 53 Florian Eßer 2009-06-28 22:42:34 UTC
I took a look at the source code (FastForwardWorker.cpp) and added some more debug messages for me.

After #121 "QSqlQuery query = db.exec( sql );",
query.size() returns about 5000 rows found.

Nevertheless each of query.first(), query.next() or query.seek() fails to get me a valid internal cursor position, so query.at() always reports -1 (meaning QSql::BeforeFirstRow).
query.lastError() tells me "QMYSQL3: Unable to fetch data".

Since query.next() is alway false, the for-loop in #126 never runs and no tracks are imported.

So the problem has to be somewhere in the MySQL section.
Strangely enough, if I take the same commands like in FastForwardWorker.cpp and put them into a small QT testing app (using hardcoded database connection settings), no error occurs and query.next() sets the cursor to a valid position.
Comment 54 Steff 2009-06-30 15:17:48 UTC
Importing data from a mysql collection doesn't work, is that still the case? I use an up-to-date Jaunty Kubuntu (Amarok 2.1.1, KDE 4.2.2 and mysql 5.0). All my ratings and things are gone...
Comment 55 Myriam Schweingruber 2009-07-16 13:00:21 UTC
Seb, any news on this? Comments #43 and #44 seems to indicate a solution. 

Changed target and moved to high priority...
Comment 56 Steff 2009-08-08 08:48:00 UTC
Hi all,
I really do miss my ratings. Got ~65000 songs in my Amarok and no hint what I tagged some years ago. Where's my hit parade, Dude :(
Does anybody have a hint what I needed to retrieve from the former MySql table and shove into the new one? Any help would be highly welcome.
Cheers,
Steff
Comment 57 Steff 2009-08-09 13:43:42 UTC
OK, I don't give up. Tried again to import my collection from Amarok 1.4 and had an eye on the thread running on the old MySql-DB...

It shows the statement running. When I run the same statement in the query browser, it stops after a while, saying:
"! 2014: Commands out of sync; you can't run this command now".
Ok, googling a bit shows:
"The error can occur in recent versions of PHP when you connect with mysql_pconnect(). Using mysql_connect() instead makes the problem go away."
Hm, PHP? Well do you? Then, there's more: http://bugs.php.net/bug.php?id=47504
Some others report this error if there are NULL values in the list where this is not expected...
Some others report this error if a semicolon is missing in the statement...
Some others report this error if a return-value is too long and blows the field...
MySql says: http://dev.mysql.com/doc/refman/5.1/de/commands-out-of-sync.html

Does that help?

Cheers,
Steff
Comment 58 Myriam Schweingruber 2009-08-09 15:56:22 UTC
Changed version to latest tested.
Comment 59 Florian Eßer 2009-08-09 16:15:47 UTC
I recently have changed the FastForwardWorker to use mysql++ instead of QT to access the Database.
It was quite a Quick&Dirty Hack (I commented out some exception trows in mysql++, since the compiler complained otherwise...), but it worked.

I changed no queries, I only used other functions to talk to the database and fetch the results.


> MySql says: http://dev.mysql.com/doc/refman/5.1/de/commands-out-of-sync.html
Hmm, out of sync? Could that have something to to with multi tasking? (wild guess)
Comment 60 Steff 2009-08-16 13:37:37 UTC
Found a solution to this problem: went back to Amarok 1.4.
Comment 61 Helmut Klein 2009-08-16 17:20:54 UTC
I have the same problem, just getting "Failed: No tracks were imported".
Quite a workaround is converting your mysql-db to sqlite.
I did so using the following steps:


1. Create an output.db using: 
$ sqlite3 output.db 
and then inserting the statements (CREATE TABLE...) listed here: http://amarok.kde.org/wiki/MySQL_HowTo#Amarok_1.4.8_and_MySQL_5.0.45
then just exit sqlite using ".quit".

2. Use the following script to convert your mysql-db to the created sqlite-db:
http://forums.mysql.com/read.php?145,68269,92627#msg-92627

now you can import the output.db with amarok2. 
The only thing I'm still missing is that "First played" won't be imported for none of my tracks.

cheers
Comment 62 Ulrich Lukas 2009-08-16 23:31:50 UTC
Thanks for your workaround, but until such basic things don't work, I
don't see myself updating to Amarok 2.
Comment 63 Manuel Amador (Rudd-O) 2009-08-17 09:01:54 UTC
Yeah!  Me too, I went back to amarok 1.4, almost year ago I think!  I was compiling RPMs for amarok 1.4 until the kde-redhat project clued up to the fact that serious music lovers are having serious trouble moving to amarok 2 / using amarok 2, and they started making an amarok1 RPM.  And with that, all my problems were solved -- I no longer have to rebuild RPMs or lock the package in my package manager.

You can now mark this bug as closed!
Comment 64 Myriam Schweingruber 2009-08-18 19:07:20 UTC
*** Bug 204289 has been marked as a duplicate of this bug. ***
Comment 65 Florian Eßer 2009-09-09 12:17:26 UTC
Today I tried again to import my old 1.4 database with the latest version compiled from git and — IT WORKED!

Could it be that this nasty bug finally got fixed?!?
Comment 66 Myriam Schweingruber 2009-10-14 10:31:40 UTC
Well, since nobody reacted on this, I guess this is fixed in Amarok 2.2.
Comment 67 Mark Kretschmann 2009-10-14 13:01:53 UTC
Additionally, 2.2.1 will bring some more fixes :)
Comment 68 Manuel Amador (Rudd-O) 2009-10-14 16:20:03 UTC
No, it is MOST DEFINITELY NOT FIXED.  I installed Amarok 2.2 and the import of the data failed (from PostgreSQL).  It hangs in there for a while and then it says that the import failed in red letters.  The console output said something of "cannot execute '' SQL statement" or something.

I do not remember exactly what happened, but I do know it doesn't work.  If anyone cares to have my music database to test the import, I will be more than glad to share it.  But I am done testing Amarok 2.2 myself until this is fixed and honestly the last time I came to the IRC channel to talk about this issue I was chased away by some asshole, so it's not like I have a great incentive to help fix the bug anyway.
Comment 69 Myriam Schweingruber 2009-10-14 19:21:44 UTC
(In reply to comment #68)
> No, it is MOST DEFINITELY NOT FIXED.  I installed Amarok 2.2 and the import of
> the data failed (from PostgreSQL).  It hangs in there for a while and then it
> says that the import failed in red letters.  The console output said something
> of "cannot execute '' SQL statement" or something.

Well, then open a new bug about PostgreSQL, this one was about MySQL and a crash. Not the same...
Comment 70 Mark Kretschmann 2009-10-14 20:16:50 UTC
@Manuel:
Please read more carefully. I said "for Amarok 2.2.1." We do have a fix for Postgres in the pipeline, so please wait for this release, or check out Amarok from Git master.
Comment 71 Jo Schulze 2009-11-23 15:42:06 UTC
I just verified with amarok2.2.1 (openSUSE 11.1 / 11.2; KDE 4.3.3) that this bug is _not_ fixed.

Import collection -> amarok 1.4 -> MySQL (I double checked that the DB access data is correct). Result:

Error: Could not execute import query:  
Failed: Unable to import statistics
Comment 72 Rick W. Chen 2009-11-23 16:04:40 UTC
(In reply to comment #71)
> I just verified with amarok2.2.1 (openSUSE 11.1 / 11.2; KDE 4.3.3) that this
> bug is _not_ fixed.
> 
> Import collection -> amarok 1.4 -> MySQL (I double checked that the DB access
> data is correct). Result:
> 
> Error: Could not execute import query:  
> Failed: Unable to import statistics

Did you try adding an entry in hosts.allow as comment #44? This has worked for me for a long time.
Comment 73 Jo Schulze 2009-11-23 16:40:54 UTC
> Did you try adding an entry in hosts.allow as comment #44? 
> This has worked for me for a long time.

No, I did not because IF TCP wrappers configuration or any network misconfiguration would be the problem here THEN 
- verifying the MySQL access credentials would fail
- amarok1.4 would fail 

The only thing which fails is importing the collection int amarok 2.2.1
Comment 74 Jo Schulze 2009-11-24 00:57:47 UTC
The feedback provided by the "Import collection" dialog seems bogus:

After giving the hostname "l33t" (which works fine for connecting on the shell) I get

Error: Could not open Amarok 1.4 database: Can't connect to MySQL server on 'l33t' (111) QMYSQL: Unable to connect

Choose "Back" in the dialog, change Hostname to eg. "localhost" (which in this case maps to the same server, Next:

Error: Could not open Amarok 1.4 database: Can't connect to MySQL server on 'l33t' (111) QMYSQL: Unable to connect

Now: either the message is wrong or (more likely) the whole import dialog code is ignoring settings (like host name changes). This is so pathetic and this bug is definitly _not_ resolved.
Comment 75 Lukas Jirkovsky 2009-11-24 07:56:26 UTC
Jo: You also need to comment out the skip_networking in my.cnf
Comment 76 Jo Schulze 2009-11-24 12:12:58 UTC
Doh, my bad. Seems that /etc/my.cnf has changed during upgradte to openSUSE 11.2 (which I did last WE).
Import did work on a machine where MySQL server is locally installed.
Just to clarify:

Comment #71 and #73 are related to a different setup: I tried to import the 1.4 MySQL database on a machine which accesses the database on a remote server.
Is it possible that such a setup isn't supported (eg. because MySQL is accessed via UNIX sockets)?