chdb icon indicating copy to clipboard operation
chdb copied to clipboard

can support jdbc bridge?

Open wonb168 opened this issue 1 year ago • 5 comments

has a clickhouse-jdbc-bridge,can chdb support this?

wonb168 avatar May 03 '24 22:05 wonb168

You can use the jdbc table function: https://clickhouse.com/docs/en/sql-reference/table-functions/jdbc

auxten avatar May 04 '24 04:05 auxten

此表函数需要单独的 clickhouse-jdbc-bridge 程序才能运行?

wonb168 avatar May 05 '24 01:05 wonb168

You don't need a standalone clickhouse-jdbc-bridge

auxten avatar May 05 '24 04:05 auxten

I tested, need install and start jdbc-bridge first:

#%%
import chdb
print(chdb.__version__)
# %%
#postgres://hvycjfbu:[email protected]:5432/hvycjfbu
url="jdbc:postgres://hvycjfbu:[email protected]:5432/hvycjfbu"
sql="select version()"
sql=f"""SELECT * FROM jdbc('{url}', '${sql}')"""
res = chdb.query(sql, 'Dataframe')
print(res)
# %%

raise error:

ChdbError: Code: 410. DB::Exception: clickhouse-jdbc-bridge is not running. Please, start it manually. (EXTERNAL_SERVER_IS_NOT_RESPONDING)

wonb168 avatar May 05 '24 12:05 wonb168

I did double check in the code. It seems JDBC will need clickhouse-jdbc-bridge started first, but ODBC does not need.

auxten avatar Jun 05 '24 05:06 auxten