Could not connect to the databse

Issue #4 resolved
AChU created an issue

Dear iMonDB and all,

In a nutshell: I am stuck at the iMonDB collecter, trying to establish the link with the database.

I'm afraid I am not very experienced in neither Windows nor mysql, so it is very likely that the problem lies with my server configuration rather than iMonDB; I would however be very grateful if you have pointers to solve my problem.

We are running 64 bit Windows 7 professional. I have installed MySQL Community Server 8.0.11 using default installation set up. I followed the instructions on https://bitbucket.org/proteinspector/imondb/wiki/Installation and could create the iMonDB database. The command

mysql -u <username> -p<password> iMonDB < CreateDB.sql

failed however, possibly the syntax seems to have changed. Is it a dump of present configuration into CreateDB.sql ? Instead I created the table by hand and performed an mysqldump into CreateDB.sql.

I have also created user imondb, although the grant command also caused issue in my version (the IDENTIFIED BY bit).

When I connect from a command line with

mysql -h localhost --port 3306 imondb -pxxxxx

and type SHOW DATABASES or describe imon_value etc, all seems to be working fine.

However, when verifying the Database connection from the collector, with

localhost 3306 iMonDB imondb xxxxx

as parameters, I get the following message:

Could not connect to the databse javax persistence.PersistenceException: Unable to build entity manager factory

We are running java 1.8.9_131....

Any idea what I should be checking for?

Many thanks in advance

Anne-Christine

Comments (4)

  1. Wout Bittremieux

    Dear Anne-Christine,

    Thank you for your interest in the iMonDB.

    This is a tricky problem to troubleshoot as the message you're seeing is a catch-all for any database connection error.

    The problem indeed seems to be that the iMonDB can't successfully connect to the MySQL database. This can have various reasons:

    • The MySQL server is not running.
    • Incorrect username/password.
    • The user has insufficient rights.
    • Incorrect database.
    • Incorrect tables in the the database.
    • ...

    So it's difficult to say exactly what's going wrong. The iMonDB creates two different log files in its root directory which might give some more information about why a database connection can't be established. Could you share those log files with me? You can attach them to this issue or mail them to me at wout.bittremieux@uantwerpen.be.

    Unfortunately I'm still running MySQL v5.7 and I'm currently not able to upgrade to MySQL v8. Indeed, based on the MySQL documentation there seem to have been some non-backwards compatible changes between both versions.

    The GRANT syntax seems to have changed in v8 to drop the IDENTIFIED BY bit, as you mentioned. I'm not sure what's going wrong with the CreateDB.sql script, but it might be some similar incompatibility with the new MySQL version. The CreateDB.sql script simply contains the table definitions, although if you have succeeded in creating all the different tables by hand that shouldn't cause the connection problem.

  2. AChU reporter

    Dear Wout,

    Many thanks for inspecting my log file.

    I do confirm that uninstalling MySQL version 8 and installing MySQL v 5.7 solved the issue! (kind of unbelievable, this backward incompatibility! MySQL is not making friends here).

    Thanks again and best wishes, Anne-Christine

  3. Wout Bittremieux

    Thanks for reporting the issue. I was similarly surprised that newer versions of MySQL don't seem to be backwards compatible.

    For the moment the documentation reflects that MySQL v5.7 is expected. I hope to be able to provide support for newer versions of MySQL in the near future.

  4. Log in to comment