OHDSI / WhiteRabbit

WhiteRabbit is a small application that can be used to analyse the structure and contents of a database as preparation for designing an ETL. It comes with RabbitInAHat, an application for interactive design of an ETL to the OMOP Common Data Model with the help of the the scan report generated by White Rabbit.
http://ohdsi.github.io/WhiteRabbit
Apache License 2.0
173 stars 85 forks source link

Unable to connect to postgres on Mac OS X #343

Closed fredkingham closed 1 year ago

fredkingham commented 1 year ago

Describe the bug Unable to connect to a postgres (11.16) on a with java 1.8 using white rabbit v0.10.7

Whether running scan tables or test connection the error is the same

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: Could not initialize class net.ucanaccess.jdbc.UcanaccessDriver

To Reproduce Steps to reproduce the behavior:

  1. Install home brew as described https://brew.sh/ Then in a terminal
  2. brew install postgresql@11
  3. psql -c "CREATE DATABASE test
  4. Install white rabbit as described by the README https://github.com/OHDSI/WhiteRabbit#getting-started
  5. Fill in the settings as shown on the screenshot
  6. Press test connection

Expected behavior A successful connection to the database

Screenshots

Screenshot 2022-07-27 at 20 16 51

Desktop (please complete the following information): Mac (OS X 12.0.1)

KeithWTomlin commented 1 year ago

I receive exactly the same error message when attempting to test connection of White Rabbit to a postgreSQL database using MacOS MacOS version: 12.5 Chip: Apple M1 Pro Java version: Java 8 update 341 PostgreSQL version: 14.4 White Rabbit version: v0.10-2.7

janblom commented 1 year ago

Hi @fredkingham , @KeithWTomlin ,

I have looked into this, and unfortunately I cannot offer a quick solution. There are two things that stand out with this issue:

  1. WhiteRabbit does not load the UcanaccesDriiver class by default. This driver is used for Microsoft Access (MSAccess) databases only. It is very likely that this is somehow locally configured to be loaded on your systems, although it is unclear to me how and why;
  2. the reported class ("net.ucanaccess.jdbc.UcanaccessDriver") is incorrect for the version of the library that is released with WhiteRabbit. It should be "net.sf.ucanaccess.jdbc.UcanaccessDriver".

While I cannot offer a solution right now, maybe this information can help you to solve the problem, or obtain more information about the cause.

joaofonseca9 commented 1 year ago

Is there any solution yet to connect White Rabbit with Postgres with a Macbook M1 machine?

janblom commented 1 year ago

When the problem was originally reported, we tested on an M1, and could not reproduce your issue, but that test was very likely not with Java 8 (probably with version 11 or 17)

We tested this again with an M1, but only with Java version 17. This way, we cannot reproduce the problem. As far as we know Java 8 for M1 runs in intel compatibility mode, so our first advice is to test with Java 11 or 17, if possible.

If you have no other option than Java 8, we can see if we can test that, but that will take some time, as we do not immediately have an M1 available where we are free to install Java 8. So if you could first test with 11 or 17, that would be great.

Other than the possible issue with the Java version on M1 macs: the reported stack trace (image) does suggest to us that somehow your Java installation has been configured to load the UcanAccessDriver class, as this is definitely not the default behaviour of WhiteRabbit. We aim to build a test version of WhiteRabbit that will log some extra info while loading the driver classes.

janblom commented 1 year ago

I have added a release marked v0.10.7a that logs a line to the console window when the system property 'jdbc.drivers' was set before trying to connect to the database (see the screen shot below for an example). Could you test the issue with this version and report any lines from the console window that look like the one in the example?

image

janblom commented 1 year ago

@fredkingham @KeithWTomlin have you been able to test with v0.10.7a, or otherwise been successful with resolving this issue?

janblom commented 1 year ago

While working on another issue I could finally reproduce this problem (on Linux/Ubuntu, using java 1.8). While I have not been able to determine exactly why an attempt is made to load the ucanaccess driver, resulting in the error mentioned, I could test and confirm 2 possible workarounds:

  1. Use a newer version of Java (I tested with version 11 and 17, and could not reproduce the problem with these versions)
  2. Remove repo/ucanaccess-5.0.1.jar (in this case it also works with Java 1.8)