GithubHelp home page GithubHelp logo

mmolimar / ksql-jdbc-driver Goto Github PK

View Code? Open in Web Editor NEW
87.0 15.0 19.0 295 KB

JDBC driver for Apache Kafka

License: Apache License 2.0

Scala 100.00%
confluent kafka apache-kafka ksql jdbc driver ksqldb

ksql-jdbc-driver's People

Contributors

d-thomson avatar mmolimar avatar mrnakumar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ksql-jdbc-driver's Issues

Cannot connect to this URL 192.168.30.190. Error message: Error issuing GET to KSQL server. path:/info

I have deployed confluent-5.2.3, and confirmed that ksql has been started and port 8088 has been listened, but there is an error in linking through JDBC

The code is as follows:
Class.forName("com.github.mmolimar.ksql.jdbc.KsqlDriver");
String url="jdbc:ksql://192.168.30.190:8088";
KsqlDriver kd= new KsqlDriver();

    System.out.println(kd.acceptsURL(url));

    KsqlConnection con = kd.buildConnection(KsqlDriver.parseUrl(url), null);

    con.validate();

    Statement statement = con.createStatement();

    ResultSet rs = statement.executeQuery("select ROWTIME,ROWKEY from USERS");

    while(rs.next()){

        System.out.println(rs.getInt(0)+" : "+rs.getString(1));

    }

The error is as follows:
Exception in thread "main" java.sql.SQLException: Cannot connect to this URL 192.168.30.190. Error message: Error issuing GET to KSQL server. path:/info
at com.github.mmolimar.ksql.jdbc.Exceptions$.wrapException(Exceptions.scala:84)
at com.github.mmolimar.ksql.jdbc.KsqlConnection.validate(KsqlConnection.scala:184)
at ksqltest.main(ksqltest.java:20)

Error connecting via SquirrelSQL

I cloned the latest repository, built a fat jar and tried to connect with SquirrelSQL 3.9.1. I receive the error below. Any clues? I have confirmed that I can connect to the KSQL engine and run queries using the Confluent CLI.

Unexpected Error occurred attempting to open an SQL connection.
class org.apache.kafka.common.config.ConfigException: Invalid value

org.apache.kafka.streams.errors.LogAndFailExceptionHandler for configuration
default.deserialization.exception.handler: Class org.apache.kafka.streams.errors.LogAndFailExceptionHandler could not be found.

Driver Failed to Connect due to Exception casting issue

Trying to do Test Connection using this driver from Jasper Server to KSQLDB (both working separately).

27-May-2020 10:51:07.225 SEVERE [http-nio-8080-exec-6] org.glassfish.jersey.server.ServerRuntime$Responder.mapException An exception has been thrown from an exception mapper class com.jaspersoft.jasperserver.jaxrs.common.GenericRemoteExceptionMapper.
java.lang.ClassCastException: java.lang.NoClassDefFoundError cannot be cast to java.lang.Exception
at com.jaspersoft.jasperserver.jaxrs.common.GenericRemoteExceptionMapper.toResponse(GenericRemoteExceptionMapper.java:66)
at com.jaspersoft.jasperserver.jaxrs.common.GenericRemoteExceptionMapper.toResponse(GenericRemoteExceptionMapper.java:45)

[Discussion] Future developments

Hello, first of all congratulations for the work done, i have had the opportunity to try your JDBC driver for a long time and i wanted to know more about future developments.
In particular, do you think it is possible to interrogate Kafka instead of KsqlDB?
To my knowledge Kafka does not expose an SQL query engine per se.
I see that your driver also works well with KsqlDB version 0.9, soon there will be the release of version 0.10 and with it most likely the new Java client (Source code)(Documentation).
In my opinion this client promises well with respect to the use of the Rest API, both on the performance side and because it exposes native methods for things like terminating queries after a certain period of time.
I'd like to hear your opinions.

Error: Could not initialize class io.confluent.ksql.config.KsqlConfigResolver

Hi

I built KSQLDB driver and can connect now to my datasource from Java, and also in SQuirrelSQL (thanks for input). However, the connection to the same datasource and using the same driver fails from some other tools that use JDBC, such as Jasper Reports community server.

The error is:

Could not initialize class io.confluent.ksql.config.KsqlConfigResolver.
at java.lang.Thread.run(Thread.java:748)
08-Jun-2020 17:54:56.804 SEVERE [http-nio-8080-exec-9] org.glassfish.jersey.server.ServerRuntime$Responder.mapException An exception was not mapped due to exception mapper failure. The HTTP 500 response will be returned.

Is there any dependencies I could include in driver via build process or any other suggestion you might have?!

Thanks

Simple Java connection fails with "No Suitable Driver"

To reproduce:

Have working KSQLDB:
http://10.5.100.192:8088/info
with page response:
KsqlServerInfo |  
version | "0.9.0"
kafkaClusterId | "0q27dVhgTmKdsdKyO3u28Q"
ksqlServiceId | "default_"

Java Code (myapp.java, simplest code, trying just to connect):
...
Class.forName("com.github.mmolimar.ksql.jdbc.KsqlDriver");
conn = DriverManager.getConnection(DB_URL);
...

Java app run:
java -cp ".:./seed-project-assembly-1.2.0.jar" myapp

Fails with Exception:
java.sql.SQLException: No suitable driver found for jdbc:ksql://10.5.100.192:8088
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:702)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:251)
at KSQLSample.main(KSQLSample.java:18)

works with ksql, but ksql-jdbc-driver says `Error issuing GET to KSQL server`

Hi,

After resolving #7 , it appears I may still have something missing.

I have a small kafka test server running ksql-engine on the default port; and can connect like so from ksql on a command line; I can list topics, etc. everything looks good.

➜  confluent-5.0.0 ./bin/ksql http://my-kafka-server:8088
                  ...clip...
                  =  Streaming SQL Engine for Apache Kafka® =
                  ===========================================

Copyright 2017-2018 Confluent Inc.
CLI v5.0.0, Server v5.0.0 located at http://my-kafka-server:8088
Having trouble? Type 'help' (case-insensitive) for a rundown of how things work!
ksql> 

However, when connecting through ksql I'm getting the following error message with the equivelent (?) connection url such as jdbc:ksql://my-kafka-server:8088:

Your server is accepting socket connections on my-kafka-server:8088.
Cannot connect to this URL my-kafka-server. Error message: Error issuing GET to KSQL server

This seems like a generic message, because even if i change my connection url to jdbc:ksql://github.com:443 I get the same error...

Apologies if I've overlooked something, and thanks again for your help.

Cannot compile :(

Is this due to the java version?

[error] sbt.librarymanagement.ResolveException: Error downloading org.openjfx:javafx.base:11.0.0-SNAPSHOT [error] Not found [error] Not found [error] not found: /Users/joel/.ivy2/local/org.openjfx/javafx.base/11.0.0-SNAPSHOT/ivys/ivy.xml [error] not found: https://repo1.maven.org/maven2/org/openjfx/javafx.base/11.0.0-SNAPSHOT/javafx.base-11.0.0-SNAPSHOT.pom [error] not found: https://packages.confluent.io/maven/org/openjfx/javafx.base/11.0.0-SNAPSHOT/javafx.base-11.0.0-SNAPSHOT.pom [error] not found: https://s3-us-west-2.amazonaws.com/confluent-snapshots/org/openjfx/javafx.base/11.0.0-SNAPSHOT/javafx.base-11.0.0-SNAPSHOT.pom [error] not found: /Users/joel/.m2/repository/org/openjfx/javafx.base/11.0.0-SNAPSHOT/javafx.base-11.0.0-SNAPSHOT.pom [error] at lmcoursier.CoursierDependencyResolution.unresolvedWarningOrThrow(CoursierDependencyResolution.scala:245) [error] at lmcoursier.CoursierDependencyResolution.$anonfun$update$34(CoursierDependencyResolution.scala:214) [error] at scala.util.Either$LeftProjection.map(Either.scala:573) [error] at lmcoursier.CoursierDependencyResolution.update(CoursierDependencyResolution.scala:214) [error] at sbt.librarymanagement.DependencyResolution.update(DependencyResolution.scala:60) [error] at sbt.internal.LibraryManagement$.resolve$1(LibraryManagement.scala:52) [error] at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$12(LibraryManagement.scala:102) [error] at sbt.util.Tracked$.$anonfun$lastOutput$1(Tracked.scala:69) [error] at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$20(LibraryManagement.scala:115) [error] at scala.util.control.Exception$Catch.apply(Exception.scala:228) [error] at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$11(LibraryManagement.scala:115) [error] at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$11$adapted(LibraryManagement.scala:96) [error] at sbt.util.Tracked$.$anonfun$inputChanged$1(Tracked.scala:150) [error] at sbt.internal.LibraryManagement$.cachedUpdate(LibraryManagement.scala:129) [error] at sbt.Classpaths$.$anonfun$updateTask0$5(Defaults.scala:2947) [error] at scala.Function1.$anonfun$compose$1(Function1.scala:49) [error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62) [error] at sbt.std.Transform$$anon$4.work(Transform.scala:67) [error] at sbt.Execute.$anonfun$submit$2(Execute.scala:281) [error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:19) [error] at sbt.Execute.work(Execute.scala:290) [error] at sbt.Execute.$anonfun$submit$1(Execute.scala:281) [error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178) [error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:37) [error] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) [error] at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [error] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) [error] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [error] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [error] at java.base/java.lang.Thread.run(Thread.java:835) [error] (update) sbt.librarymanagement.ResolveException: Error downloading org.openjfx:javafx.base:11.0.0-SNAPSHOT [error] Not found [error] Not found [error] not found: /Users/joel/.ivy2/local/org.openjfx/javafx.base/11.0.0-SNAPSHOT/ivys/ivy.xml [error] not found: https://repo1.maven.org/maven2/org/openjfx/javafx.base/11.0.0-SNAPSHOT/javafx.base-11.0.0-SNAPSHOT.pom [error] not found: https://packages.confluent.io/maven/org/openjfx/javafx.base/11.0.0-SNAPSHOT/javafx.base-11.0.0-SNAPSHOT.pom [error] not found: https://s3-us-west-2.amazonaws.com/confluent-snapshots/org/openjfx/javafx.base/11.0.0-SNAPSHOT/javafx.base-11.0.0-SNAPSHOT.pom [error] not found: /Users/joel/.m2/repository/org/openjfx/javafx.base/11.0.0-SNAPSHOT/javafx.base-11.0.0-SNAPSHOT.pom [error] Total time: 7 s, completed 14 de març 2020, 11:19:21

Exception when trying to run simple test

Hello I tried to test the driver out but When compiling the source "sbt compile" and try to run it "sbt run" to test I get Java.lang.runtimeExpection: no main class detected

when I package the code and try to run the simple Java app I get error with using the driver

Class.forname("com.github.mmolimar.ksql.jdbc.ksqldriver");

Exception in thread "main" Java.lang.NoClassDefFoundError: scala/ Function1
At java.lang.class.forname0(native method)
At java.lang.class.forname(unknown source)
...

Did anyone stumble on similar issue and knows how to overcome it?

Thank you.

Build Fails Two Places

I'm very new to building with SBT, so please be patient.

  1. [error] [launcher] download failed: org.scala-lang.modules#scala-xml_2.12;1.2.0!scala-xml_2.12.jar(bundle)
    I fixed error #1 by finding the file and placing it in the .sbt\preloaded\org\scala-lang\modules\scala-xml_2.12\1.2.0 directory.

  2. [warn] Note: Unresolved dependencies path:
    [error] sbt.librarymanagement.ResolveException: Error downloading org.openjfx:javafx.base:11.0.0-SNAPSHOT

I fixed error #2 by figuring out how to add a repo to build.sbt. Several trials/errors later, adding the following worked:
resolvers ++= Seq(
MavenRepo("confluent", "https://packages.confluent.io/maven/"),
Resolver.sonatypeRepo("public")
)
Again, I'm not 100% sure workaround #2 will work for others.

No suitable driver found error during the loading class

Hi,

I am developing a simple JDBC program to use this as JDBC driver and I am facing below issue:

I am able connect to ksqlDB when I am loading the driver using the code snippet below.
java.sql.DriverManager.registerDriver(new com.github.mmolimar.ksql.jdbc.KsqlDriver)

But while using the snippet below, it is providing error as "No suitable driver found for jdbc:ksql://xxx.com:8088/".

Class.forName("com.github.mmolimar.ksql.jdbc.KsqlDriver")
connection = DriverManager.getConnection("jdbc:ksql://xxx:8088");

Also when I am trying to use the driver in Kafka Connect via JDBC connector (from another Kafka cluster to ksqlDB), then there also facing the same issue.

It will be great help to have a solution for this issue.

Regards!
Devesh

jdbc query tool - Feature not supported: getMoreResult

Hi,

I'm happily connecting to ksql with a built/complied jar driver with a jdbc query tool.

I can run creates, shows, selects, describes, etc.

However, after I run anything at all, i seem to get the error message Feature not supported: getMoreResults.

Anyone else getting this?

Thanks,

show streams;

STREAM_NAME                             STREAM_TOPIC                     STREAM_FORMAT
--------------------------------------  -------------------------------  ----------------
my_stream                               my_topic                         JSON

1 record(s) selected [Fetch MetaData: 0ms] [Fetch Data: 2ms]

>[Error] Script lines: 1-2 --------------------------
Feature not supported: getMoreResults.

[Executed: 5/23/2019 3:37:32 PM] [Execution: 206ms]

Error with STRUCT Dereference operator

Hello,

My team is running into an issue with the STRUCT Dereference operator. We have the following stream in KSQL (the orders_topic topic is produced by ksql-datagen):

CREATE STREAM orders_raw (
        itemid VARCHAR,
        orderunits DOUBLE,
        address STRUCT<
            city VARCHAR,
            state VARCHAR,
            zipcode INT>,
        ordertime VARCHAR)
     WITH (
        KAFKA_TOPIC='orders_topic',
        VALUE_FORMAT='JSON');

From the ksql CLI, this works as expected:

ksql> select address->city from orders_raw limit 5;
City_82
City_34
City_72
City_98
City_46
Limit Reached
Query terminated

When we run this query through the JDBC driver, we get the following:

java.sql.SQLException: Error getting metadata for query: 'SELECT ADDRESS->CITY FROM ORDERS_RAW LIMIT 5;'. Error: io.confluent.ksql.analyzer.ExpressionAnalyzer$Visitor.visitDereferenceExpression(ExpressionAnalyzer.java:120)
io.confluent.ksql.parser.tree.DereferenceExpression.accept(DereferenceExpression.java:54)
io.confluent.ksql.parser.tree.AstVisitor.process(AstVisitor.java:22)
io.confluent.ksql.analyzer.ExpressionAnalyzer.analyzeExpression(ExpressionAnalyzer.java:47)
io.confluent.ksql.analyzer.Analyzer.analyzeExpressions(Analyzer.java:203)
io.confluent.ksql.analyzer.Analyzer.visitQuerySpecification(Analyzer.java:130)
io.confluent.ksql.analyzer.Analyzer.visitQuerySpecification(Analyzer.java:68)
io.confluent.ksql.parser.tree.QuerySpecification.accept(QuerySpecification.java:136)
io.confluent.ksql.parser.tree.AstVisitor.process(AstVisitor.java:22)
io.confluent.ksql.parser.DefaultTraversalVisitor.visitQuery(DefaultTraversalVisitor.java:126)
io.confluent.ksql.parser.tree.Query.accept(Query.java:64)
io.confluent.ksql.parser.tree.AstVisitor.process(AstVisitor.java:22)
io.confluent.ksql.analyzer.QueryAnalyzer.analyze(QueryAnalyzer.java:44)
io.confluent.ksql.QueryEngine.buildQueryLogicalPlan(QueryEngine.java:111)
io.confluent.ksql.QueryEngine.buildLogicalPlans(QueryEngine.java:86)
io.confluent.ksql.KsqlEngine.getQueryExecutionPlan(KsqlEngine.java:260)
io.confluent.ksql.rest.server.resources.KsqlResource.lambda$registerKsqlStatementTasks$21(KsqlResource.java:634)
io.confluent.ksql.rest.server.resources.KsqlResource.getStatementExecutionPlan(KsqlResource.java:619)
io.confluent.ksql.rest.server.resources.KsqlResource.explainQuery(KsqlResource.java:601)
...

Can you think of something that's wrong in our query, or a possible bug in KSQL or your driver?

Thanks,
Michael

R2DBC Driver

Is there any chance you'll implement an R2DBC driver for ksqldb?

ClassNotFoundException

confluent

I am trying to connect to ksqldb
public class MainClass {

public static void main(String[] args) {
	try {
		Class.forName("com.github.mmolimar.ksql.jdbc.KsqlDriver");
		KsqlDriver driver=new KsqlDriver();
		String url="jdbc:ksql://localhost:8089";
		
		KsqlConnection con=driver.buildConnection(KsqlDriver.parseUrl(url), null);
		Statement st=con.createStatement();
		ResultSet rs=st.executeQuery("select * from KSQLTEST");
		
		while(rs.next()) {
			System.out.println(rs.getString(0));
		}
	} catch (ClassNotFoundException | SQLException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}

}

but I m facing this issue
Exception in thread "main" java.lang.NoClassDefFoundError: io/confluent/ksql/rest/client/KsqlRestClient
at com.github.mmolimar.ksql.jdbc.KsqlConnection.init(KsqlConnection.scala:177)
at com.github.mmolimar.ksql.jdbc.KsqlConnection.(KsqlConnection.scala:163)
at com.github.mmolimar.ksql.jdbc.KsqlDriver.buildConnection(KsqlDriver.scala:71)
at com.torana.ksqldemo.MainClass.main(MainClass.java:21)
Caused by: java.lang.ClassNotFoundException: io.confluent.ksql.rest.client.KsqlRestClient
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 4 more

UNRESOLVED DEPENDENCIES: org.scala-lang#scala-library;2.10.6

$ sbt clean package
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dsun.java2d.pmoffscreen=false -XX:+UseCompressedOops -XX:+DoEscapeAnalysis -XX:+AggressiveOpts -XX:+EliminateLocks -XX:+UseNUMA -XX:+TieredCompilation
Getting org.scala-sbt sbt 0.13.9 ...

:: problems summary ::
:::: WARNINGS
                ::::::::::::::::::::::::::::::::::::::::::::::

                ::          UNRESOLVED DEPENDENCIES         ::

                ::::::::::::::::::::::::::::::::::::::::::::::

                :: org.scala-lang#scala-library;2.10.6: configuration not found in org.scala-lang#scala-library;2.10.6: 'master'. It was required from org.scala-tools.sbinary#sbinary_2.10;0.4.2 default

                ::::::::::::::::::::::::::::::::::::::::::::::



:: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
unresolved dependency: org.scala-lang#scala-library;2.10.6: configuration not found in org.scala-lang#scala-library;2.10.6: 'master'. It was required from org.scala-tools.sbinary#sbinary_2.10;0.4.2 default
Error during sbt execution: Error retrieving required libraries
  (see /home/pasha/.sbt/boot/update.log for complete log)
Error: Could not retrieve sbt 0.13.9

Cannot connect to this URL server

I was able to build the jar using sbt. There were many issue w.r.t class not found exception. after adding all the jars, now I am getting
Exception in thread "main" java.sql.SQLException: Cannot connect to this URL "server". Error message: Error issuing GET to KSQL server

any suggestion.

readme build instructions seem incorrect?

From this line:

git clone https://github.com/confluentinc/ksql.git && cd ksql && git v4.1.0-rc3

I'm getting an error on the this part:

➜  ksql git:(master) git v4.1.0-rc3
git: 'v4.1.0-rc3' is not a git command. See 'git --help'.
➜  ksql git:(master)                       

That has to be a typo right?

I'm just trying to get a jar file for other applications to connect to ksql engines.... is anything in maven central where i can just pull a nicely packaged *.jar?

Thanks in advance,

The issue to access to Kstream

image

Hi there, we meet a problem about accessing to the Ksql. We use docker compose to launch the kafka. So there is no username and password. Does it affect? Or how to solve the question? Thanks

How to get older data from a table with a self terminating query?

Hi Mario,

Thank you for the new release of the driver, I am now able to connect to a KSQL instance. I am able to query metadata (SHOW STREAMS; SHOW TABLES; etc.) however I am having trouble finding a way to query old data from a table where the query wont hang.

The code snippet I'm using:

// query: SELECT * FROM USERS_ORIGINAL LIMIT 3
//rs.beforeFirst(); // <<NOT SUPPORTED  

while (rs.next()) { // << "HANGS" HERE
	for (int colInd = 1; colInd <= rsMetaData.getColumnCount(); colInd++){
		String val = rs.getString(colInd);
                System.out.print(val);
                System.out.print("\t");
	}
	System.out.println();
}

The issue seems to be that the pointer for a table is always at the latest position, so when I run the query the driver seems to hang because there is no data coming in. I see that there is a way to set the offset to the earliest position using the following command

SET 'auto.offset.reset' = 'earliest';

but this doesn't seem to be supported by the driver. Do you know if there is a way to set this globally for the KSQL instance or if there's a way to specify this in the query itself?

Much appreciated.
Daniel

Feature not supported: getType

Hello,

I am using Groovy, which has nice groovy.sql.Sql. I would like to use it with ksql and therefore I have installed your jdbc...
This is my simple code:
import groovy.sql.Sql

class GroSandbox02Main {
static void main(String[] args) {
java.sql.DriverManager.registerDriver(new com.github.mmolimar.ksql.jdbc.KsqlDriver())
Sql sqlKsql = Sql.newInstance('jdbc:ksql://localhost:8088')
String selStreams="""
SELECT * FROM policy EMIT CHANGES"""
sqlKsql.eachRow(selStreams) { GroovyResultSet rs ->
println rs
}
sqlKsql.close()
}
}

resulting in:
SELECT * FROM policy EMIT CHANGES because: Feature not supported: getType.
Exception in thread "main" java.sql.SQLFeatureNotSupportedException: Feature not supported: getType.
at com.github.mmolimar.ksql.jdbc.Exceptions$.wrapException(Exceptions.scala:83)
at com.github.mmolimar.ksql.jdbc.resultset.ResultSetNotSupported.getType(ResultSet.scala:19)
at groovy.sql.Sql.moveCursor(Sql.java:1277)
at groovy.sql.Sql.eachRow(Sql.java:1259)
at groovy.sql.Sql.eachRow(Sql.java:1219)
at groovy.sql.Sql.eachRow(Sql.java:1156)
at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:318)
at com.tcc.GroSandbox02Main.main(GroSandbox02Main.groovy:12)

Can you help me? Thank you very much for this work...

Jirka

Error parsing query: mismatched input 'PRIMARY' expecting {',', ')'

I've continue try (#29) using that driver and on query:

CREATE TABLE proposals_table (id STRING PRIMARY KEY) WITH (kafka_topic='datahub.epm_staf.qa20.v1.m_proposals', value_format='AVRO');

got error:
SQL Error: Error parsing query 'CREATE TABLE proposals_table (id STRING PRIMARY KEY) WITH (kafka_topic = 'datahub.epm_staf.qa20.v1.m_proposals', value_format='AVRO');': line 1:41: mismatched input 'PRIMARY' expecting {',', ')'}

Stacktrace:

org.jkiss.dbeaver.model.sql.DBSQLException: SQL Error: Error parsing query 'CREATE TABLE proposals_table (id STRING PRIMARY KEY) WITH (kafka_topic = 'datahub.epm_staf.qa20.v1.m_proposals', value_format='AVRO');': line 1:41: mismatched input 'PRIMARY' expecting {',', ')'}
Statement: CREATE TABLE proposals_table (id STRING PRIMARY KEY) WITH (kafka_topic = 'datahub.epm_staf.qa20.v1.m_proposals', value_format='AVRO');..
	at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:133)
	at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.executeStatement(SQLQueryJob.java:509)
	at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.lambda$0(SQLQueryJob.java:440)
	at org.jkiss.dbeaver.model.exec.DBExecUtils.tryExecuteRecover(DBExecUtils.java:168)
	at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.executeSingleQuery(SQLQueryJob.java:427)
	at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.extractData(SQLQueryJob.java:812)
	at org.jkiss.dbeaver.ui.editors.sql.SQLEditor$QueryResultsContainer.readData(SQLEditor.java:3096)
	at org.jkiss.dbeaver.ui.controls.resultset.ResultSetJobDataRead.lambda$0(ResultSetJobDataRead.java:121)
	at org.jkiss.dbeaver.model.exec.DBExecUtils.tryExecuteRecover(DBExecUtils.java:168)
	at org.jkiss.dbeaver.ui.controls.resultset.ResultSetJobDataRead.run(ResultSetJobDataRead.java:119)
	at org.jkiss.dbeaver.ui.controls.resultset.ResultSetViewer$ResultSetDataPumpJob.run(ResultSetViewer.java:4460)
	at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:105)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.sql.SQLException: Error parsing query 'CREATE TABLE proposals_table (id STRING PRIMARY KEY) WITH (kafka_topic = 'datahub.epm_staf.qa20.v1.m_proposals', value_format='AVRO');': line 1:41: mismatched input 'PRIMARY' expecting {',', ')'}
Statement: CREATE TABLE proposals_table (id STRING PRIMARY KEY) WITH (kafka_topic = 'datahub.epm_staf.qa20.v1.m_proposals', value_format='AVRO');..
	at com.github.mmolimar.ksql.jdbc.Exceptions$.wrapException(Exceptions.scala:84)
	at com.github.mmolimar.ksql.jdbc.KsqlStatement.executeKsqlRequest(KsqlStatement.scala:149)
	at com.github.mmolimar.ksql.jdbc.KsqlStatement.execute(KsqlStatement.scala:187)
	at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.execute(JDBCStatementImpl.java:327)
	at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:130)
	... 12 more
Caused by: io.confluent.ksql.parser.exception.ParseFailedException: line 1:41: mismatched input 'PRIMARY' expecting {',', ')'}
Statement: CREATE TABLE proposals_table (id STRING PRIMARY KEY) WITH (kafka_topic = 'datahub.epm_staf.qa20.v1.m_proposals', value_format='AVRO');
	at io.confluent.ksql.parser.DefaultKsqlParser.parse(DefaultKsqlParser.java:64)
	at com.github.mmolimar.ksql.jdbc.KsqlStatement.$anonfun$executeKsqlRequest$1(KsqlStatement.scala:148)
	at scala.util.Try$.apply(Try.scala:213)
	at com.github.mmolimar.ksql.jdbc.KsqlStatement.executeKsqlRequest(KsqlStatement.scala:148)
	... 15 more
Caused by: io.confluent.ksql.parser.ParsingException: line 1:41: mismatched input 'PRIMARY' expecting {',', ')'}
	at io.confluent.ksql.parser.DefaultKsqlParser$1.syntaxError(DefaultKsqlParser.java:50)
	at org.antlr.v4.runtime.ProxyErrorListener.syntaxError(ProxyErrorListener.java:41)
	at org.antlr.v4.runtime.Parser.notifyErrorListeners(Parser.java:544)
	at org.antlr.v4.runtime.DefaultErrorStrategy.reportInputMismatch(DefaultErrorStrategy.java:299)
	at org.antlr.v4.runtime.DefaultErrorStrategy.reportError(DefaultErrorStrategy.java:124)
	at io.confluent.ksql.parser.SqlBaseParser.tableElements(SqlBaseParser.java:2117)
	at io.confluent.ksql.parser.SqlBaseParser.statement(SqlBaseParser.java:1541)
	at io.confluent.ksql.parser.SqlBaseParser.singleStatement(SqlBaseParser.java:260)
	at io.confluent.ksql.parser.SqlBaseParser.statements(SqlBaseParser.java:208)
	at io.confluent.ksql.parser.DefaultKsqlParser.getParseTree(DefaultKsqlParser.java:108)
	at io.confluent.ksql.parser.DefaultKsqlParser.parse(DefaultKsqlParser.java:57)
	... 18 more
Caused by: org.antlr.v4.runtime.InputMismatchException
	at org.antlr.v4.runtime.DefaultErrorStrategy.sync(DefaultErrorStrategy.java:242)
	at io.confluent.ksql.parser.SqlBaseParser.tableElements(SqlBaseParser.java:2096)
	... 23 more

On ksqlDB cli it works pretty well:

ksql> CREATE TABLE proposals_table (id STRING PRIMARY KEY) WITH (kafka_topic = 'datahub.epm_staf.qa20.v1.m_proposals', value_format='AVRO');

 Message       
---------------
 Table created 
---------------

Unable to find class file: scala/Function1

Hi,

  • I've compiled the jdbc driver I believe correctly as per the instructions in the readme.
  • I have registered the jdbc driver in an application that allows for testing/analysis of generic jdbc connections, specically aqua data studio.
    • This basically consists of shutting down the app, and adding my jar file for ksql to the lib directory of the aqua data studio java app, and restarting.
  • I'm getting the error message "unable to find class file: scala/Function1" ...
  • I'm not sure if it's related, but aqua data studio is running over jvm 1.8.
  • Not sure on the user/password for my little test, but at this point i'm not even getting that far...

Any tips appreciated, thanks.

Register Server:

inbox org_20180815_082702_nuyvq1

Driver setup:

inbox org_20180815_082722_1vbvd2

The actual error:

inbox org_20180815_082939_ytwnxt

is any files available?function list .etc?

Hi, i‘m interested in this project and want to know more about it,so would you please offer me some doucuments, such as supported version, dev plan...,anything about this wonderful project. thanks.

NPE at scala.collection.mutable.ArrayOps$ofRef$.length$extension(ArrayOps.scala:204)

Hello.

I've trying use that driver with DBeaver.

At very simple operations it works. But for example on the try discover tables list it gives me the exception:

2020-11-25 15:31:06.940 -                                                                                                                                                                                                                   
java.lang.NullPointerException                                                                                                                                                                                                              
        at scala.collection.mutable.ArrayOps$ofRef$.length$extension(ArrayOps.scala:204)                                                                                                                                                    
        at scala.collection.mutable.ArrayOps$ofRef.length(ArrayOps.scala:204)                                                                                                                                                               
        at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:35)                                                                                                                                                       
        at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:33)                                                                                                                                                      
        at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:198)                                                                                                                                                              
        at com.github.mmolimar.ksql.jdbc.KsqlDatabaseMetaData.getTables(KsqlDatabaseMetaData.scala:501)                                                                                                                                     
        at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCDatabaseMetaDataImpl.getTables(JDBCDatabaseMetaDataImpl.java:1116)                                                                                                                    
        at org.jkiss.dbeaver.ext.generic.model.meta.GenericMetaModel.prepareTableLoadStatement(GenericMetaModel.java:505)                                                                                                                   
        at org.jkiss.dbeaver.ext.generic.model.TableCache.prepareLookupStatement(TableCache.java:68)                                                                                                                                        
        at org.jkiss.dbeaver.ext.generic.model.TableCache.prepareLookupStatement(TableCache.java:1)                                                                                                                                         
        at org.jkiss.dbeaver.model.impl.jdbc.cache.JDBCStructLookupCache.prepareObjectsStatement(JDBCStructLookupCache.java:137)                                                                                                            
        at org.jkiss.dbeaver.model.impl.jdbc.cache.JDBCObjectCache.loadObjects(JDBCObjectCache.java:105)                                                                                                                                    
        at org.jkiss.dbeaver.model.impl.jdbc.cache.JDBCObjectCache.getAllObjects(JDBCObjectCache.java:73)                                                                                                                                   
        at org.jkiss.dbeaver.ext.generic.model.GenericObjectContainer.getTables(GenericObjectContainer.java:127)                                                                                                                            
        at org.jkiss.dbeaver.ext.generic.model.GenericObjectContainer.getPhysicalTables(GenericObjectContainer.java:111)                                                                                                                    
        at org.jkiss.dbeaver.ext.generic.model.GenericDataSource.getPhysicalTables(GenericDataSource.java:363)                                                                                                                              
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)                                                                                                                                                                      
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)                                                                                                                                                    
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)                                                                                                                                            
        at java.lang.reflect.Method.invoke(Method.java:498)                                                                                                                                                                                 
        at org.jkiss.dbeaver.model.navigator.DBNDatabaseNode.extractPropertyValue(DBNDatabaseNode.java:871)                                                                                                                                 
        at org.jkiss.dbeaver.model.navigator.DBNDatabaseNode.access$1(DBNDatabaseNode.java:852)                                                                                                                                             
        at org.jkiss.dbeaver.model.navigator.DBNDatabaseNode$PropertyValueReader.run(DBNDatabaseNode.java:914)                                                                                                                              
        at org.jkiss.dbeaver.model.navigator.DBNDatabaseNode$PropertyValueReader.run(DBNDatabaseNode.java:1)                                                                                                                                
        at org.jkiss.dbeaver.model.exec.DBExecUtils.tryExecuteRecover(DBExecUtils.java:168)                                                                                                                                                 
        at org.jkiss.dbeaver.model.navigator.DBNDatabaseNode.loadTreeItems(DBNDatabaseNode.java:538)                                                                                                                                        
        at org.jkiss.dbeaver.model.navigator.DBNDatabaseNode.loadChildren(DBNDatabaseNode.java:428)                                                                                                                                         
        at org.jkiss.dbeaver.model.navigator.DBNDatabaseNode.getChildren(DBNDatabaseNode.java:205)                                                                                                                                          
        at org.jkiss.dbeaver.model.navigator.DBNDatabaseNode.getChildren(DBNDatabaseNode.java:1)                                                                                                                                            
        at org.jkiss.dbeaver.model.navigator.DBNUtils.getNodeChildrenFiltered(DBNUtils.java:70)                                                                                                                                             
        at org.jkiss.dbeaver.ui.navigator.database.load.TreeLoadService.evaluate(TreeLoadService.java:49)                                                                                                                                   
        at org.jkiss.dbeaver.ui.navigator.database.load.TreeLoadService.evaluate(TreeLoadService.java:1)                                                                                                                                    
        at org.jkiss.dbeaver.ui.LoadingJob.run(LoadingJob.java:88)                                                                                                                                                                          
        at org.jkiss.dbeaver.ui.LoadingJob.run(LoadingJob.java:72)                                                                                                                                                                          
        at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:105)                                                                                                                                                            
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.