Skip to content

Commit

Permalink
feat: support PrestoDB
Browse files Browse the repository at this point in the history
  • Loading branch information
arjenzhou committed Oct 21, 2021
1 parent 74ccfd6 commit 75f7ba2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@
<artifactId>postgresql</artifactId>
<version>9.4.1212.jre7</version>
</dependency>
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-jdbc</artifactId>
<version>0.263.1</version>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
Expand All @@ -77,6 +82,7 @@
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>de.xab.ping.Entry</mainClass>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
<minimizeJar>false</minimizeJar>
<createDependencyReducedPom>true</createDependencyReducedPom>
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/de/xab/ping/connector/JDBCConnector.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package de.xab.ping.connector;

import com.google.common.base.Throwables;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -16,6 +17,7 @@ public boolean test(String url, String username, String password, String sql, Pr
ResultSet resultSet = statement.executeQuery(sql)) {
return printResultSet(resultSet);
} catch (SQLException e) {
logger.error(Throwables.getStackTraceAsString(e));
return false;
}
}
Expand All @@ -34,8 +36,8 @@ protected boolean printResultSet(ResultSet resultSet) throws SQLException {

logger.info(column.toString());
logger.info("---");
StringBuilder row = new StringBuilder();
while (resultSet.next()) {
StringBuilder row = new StringBuilder();
for (int i = 0; i < columnCount; i++) {
row.append(" ").append(resultSet.getString(i + 1));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package de.xab.ping.connector.impl;

import de.xab.ping.connector.JDBCConnector;

public class PrestoDBConnector extends JDBCConnector {

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
h2=de.xab.ping.connector.impl.H2Connector
postgresql=de.xab.ping.connector.impl.PostgreSQLConnector
hive=de.xab.ping.connector.impl.HiveConnector
impala=de.xab.ping.connector.impl.ImpalaConnector
impala=de.xab.ping.connector.impl.ImpalaConnector
prestodb=de.xab.ping.connector.impl.PrestoDBConnector

0 comments on commit 75f7ba2

Please sign in to comment.