shzlw / poli

An easy-to-use BI server built for SQL lovers. Power data analysis in SQL and gain faster business insights.
https://shzlw.github.io/poli
MIT License
1.96k stars 332 forks source link

Clickhouse JDBC driver support #80

Open rodabt opened 3 years ago

rodabt commented 3 years ago

Hi all,

I'm trying to use Poli with Clickhouse using the official JDBC driver, but after setting parameters it shows an Internal Server error message in Poli:

Internal Server Error: org/apache/http/conn/ConnectionKeepAliveStrategy

I've tried increasing JDBC parameters like connect_timeout and similar to no avail.

Is there any workaround?

Thanks!

shzlw commented 3 years ago

Hey, thanks for using Poli.

I can reproduce your issue. It throws a no class found error when I try to test the connection because it cannot find the httpclientcomponent dependency the jdbc driver needs. The root cause is the clickhouse jdbc in maven has no dependencies included.

Here is how I fix it.

My environment:

Steps:

  1. I followed the instructions on clickhouse website to install database, set a root password and create a database called tutorial.
  2. I cloned clickhouse jdbc source code from its git repo.
  3. If you go to that page and scroll down, you will see a command to build a jar with dependencies. When I run it, it gives me an error complaining about javadocs. To bypass that, I just modify the pom.xml and removed the following piece between line 171-183.
          <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.9.1</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
  4. After removing that block, I run the the command again and it generates a jar called clickhouse-jdbc-0.2.4-jar-with-dependencies.jar under target folder.
  5. I copied it to poli-0.12.2/jdbc-drivers folder, started the server and the test connection works for me.

Here is my datasource setup ds

rodabt commented 3 years ago

Hi shzlw! Thanks for looking at it. Poli it's a wonderful product!

I followed your suggestions and generated a new jar with all dependencies. Copied that to jdbc-drivers, but after I restarted poli it throws a new error:

Internal Server Error: com.fasterxml.jackson.annotation.JsonFormat$Value.hasLenient()Z

By the way, I'm using the docker version of Poli....and Windows 10

rodabt commented 3 years ago

Tried again again with a fresh new install of Ubuntu 20.04 (on Docker), latest openjdk-11 and latest poli (0.12.2).

Cloned jdbc driver to that machine and generated .jar with dependencies using mvn, excluding javadoc dependency portion. Still the getting same error: Internal Server Error: 'boolean com.fasterxml.jackson.annotation.JsonFormat$Value.hasLenient()'

shzlw commented 3 years ago

I only tested the data source connection by clicking the ping button. Did you get the exception when you try to ping the database or it happened when you tried to run a query in a report?

rodabt commented 3 years ago

I only tested the data source connection by clicking the ping button. Did you get the exception when you try to ping the database or it happened when you tried to run a query in a report?

It happens after restarting during login. First I started the app, changed password, added the new driver, then restarted...and there appears the error when I try to login. Somehow the addition of that jar interferes with the login process...

shzlw commented 3 years ago

Docker in my Ubuntu is messed up. I will need to try it on my Mac. Please just try install Poli through release zip to see if you still get the error or it is Poli in docker specific.