ksql-jdbc-driver icon indicating copy to clipboard operation
ksql-jdbc-driver copied to clipboard

The issue to access to Kstream

Open samyujialiu opened this issue 4 years ago • 20 comments

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

samyujialiu avatar Mar 09 '20 04:03 samyujialiu

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

Try to use the fat jar, in any case username and password have nothing to do with it sbt "set test in assembly := {}" assembly and if it still doesn't work, try with java -cp '.:ksql-jdbc-driver-assembly-1.2.0.jar:' Main

AndreaTosti avatar Mar 09 '20 08:03 AndreaTosti

HI, I have used the fat jar. There is no errors but still cant access to Ktable. Can you pls upload some examples about how to use the driver ? Thanks a lot

samyujialiu avatar Mar 09 '20 22:03 samyujialiu

image I got stuck when using the driver, Can anyone give me a hand?

samyujialiu avatar Mar 10 '20 01:03 samyujialiu

Hi. In the usage section in the README file you can see some notes in this sense, and then use it as whichever JDBC driver. Also here you have more info.

Another option could be using SQuirrel SQL client: build the far jar, put into the SQuirrel classpath and connect to KSQL.

Both options work.

mmolimar avatar Mar 10 '20 01:03 mmolimar

Hi, Do I need to set username and password? I cant access to the Ktabke even I put the far jar in SQuirrel SQL . Thanks

samyujialiu avatar Mar 10 '20 20:03 samyujialiu

Also, Can you pls show me a correct URL format. Thanks

samyujialiu avatar Mar 10 '20 20:03 samyujialiu

Sry about it. Now we can access to kafka. And it can show the Kstreams. But there are some problems. 1. select command cant ends 2. Cant see any tables Hope you can help us with that thanks image
image

samyujialiu avatar Mar 11 '20 00:03 samyujialiu

Try putting after the query a EMIT CHANGES LIMIT <NUMBER>.

mmolimar avatar Mar 11 '20 00:03 mmolimar

image

samyujialiu avatar Mar 11 '20 00:03 samyujialiu

Which version of KSQL are you using? Try removing EMIT CHANGES.

mmolimar avatar Mar 11 '20 02:03 mmolimar

image We use ksq:5.3.1 and once we use select command, it will not stop. Thanks fo r your help

samyujialiu avatar Mar 11 '20 03:03 samyujialiu

That does not stop is normal behavior if there are less than 4 rows. I also recommend trying to run a SET "auto.offset.reset"="earliest" before executing that query.

AndreaTosti avatar Mar 11 '20 08:03 AndreaTosti

So how can we get the whole table if the query not stop? We are trying to extract the tables the whole tables from KSQL for our applications. If it works, we are going to use the jar. Thanks

samyujialiu avatar Mar 11 '20 20:03 samyujialiu

So how can we get the whole table if the query not stop? We are trying to extract the tables the whole tables from KSQL for our applications. If it works, we are going to use the jar. Thanks

I try to have my say after spending hours and hours on this. To my knowledge there is no easy and standard way to do it, one of the mechanisms is to exploit the timeout, but it is not the best if the system is slow. Another way is to use the LIMIT clause, specifying the number of lines, but you need to make sure that they are all there for the query to end. To know the number of lines usually in the RDBMS, a SELECT COUNT (*) FROM TABLENAME is used, but KsqlDB currently offers this after so many tricks. One of them is to create a MATERIALIZED VIEW that counts the number of lines, but one should be made for each different query. There is a large debate on this.

AndreaTosti avatar Mar 12 '20 10:03 AndreaTosti

hi may be all the problem caused by the error. Any ideas? thanks image

samyujialiu avatar Mar 12 '20 21:03 samyujialiu

Try executing one query at a time

AndreaTosti avatar Mar 12 '20 21:03 AndreaTosti

HI, Thanks for your help. Now, we can connect to KSQLDB through Dbeaver. But I want to ask is it possible to use the functions on the left? Thanks for your help
image

samyujialiu avatar Mar 15 '20 20:03 samyujialiu

HI, Thanks for your help. Now, we can connect to KSQLDB through Dbeaver. But I want to ask is it possible to use the functions on the left? Thanks for your help

I'm sorry but I've never used DBeaver. However the visualization of the STREAM and the TABLE works, at least I recommend to see what the logs say.

AndreaTosti avatar Mar 15 '20 20:03 AndreaTosti

Hi samyujialiu, Could you please show me your "Connection settings" in DBeaver? Here is mine: Screen Shot 2022-03-10 at 8 01 22 AM I can show tables and streams, but can't select any table, e.g. select * from RIDERLOCATIONS; Thanks!

weiyu-chata avatar Mar 10 '22 15:03 weiyu-chata

screenshots: Screen Shot 2022-03-10 at 8 08 12 AM Screen Shot 2022-03-10 at 8 08 26 AM Screen Shot 2022-03-10 at 8 09 04 AM

weiyu-chata avatar Mar 10 '22 15:03 weiyu-chata