ClickHouse-Native-JDBC icon indicating copy to clipboard operation
ClickHouse-Native-JDBC copied to clipboard

Invalid argument: Missing port number

Open jiangjiguang opened this issue 3 years ago • 4 comments

clickhouse version is 21.5.9.4 <clickhouse-native-jdbc.version>2.5.3</clickhouse-native-jdbc.version> <clickhouse-jdbc.version>0.2.4</clickhouse-jdbc.version>

when one thread write data to clickhouse, it succeed. But when two thread write data to clickhouse, there is the error: com.github.housepower.jdbc.ClickHouseSQLException: DB::ExceptionDB::Exception: Invalid argument: Missing port number. Stack trace:

Poco::Net::SocketAddress::init(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) @ 0x125189b7 in /usr/bin/clickhouse DB::ClientInfo::read(DB::ReadBuffer&, unsigned long) @ 0xefa1bc0 in /usr/bin/clickhouse DB::TCPHandler::receiveQuery() @ 0xfea0f0b in /usr/bin/clickhouse DB::TCPHandler::receivePacket() @ 0xfe98267 in /usr/bin/clickhouse DB::TCPHandler::runImpl() @ 0xfe90b0a in /usr/bin/clickhouse DB::TCPHandler::run() @ 0xfea3bb9 in /usr/bin/clickhouse Poco::Net::TCPServerConnection::start() @ 0x12522d2f in /usr/bin/clickhouse Poco::Net::TCPServerDispatcher::run() @ 0x125247ba in /usr/bin/clickhouse Poco::PooledThread::run() @ 0x1265d8d9 in /usr/bin/clickhouse Poco::ThreadImpl::runnableEntry(void*) @ 0x126598ca in /usr/bin/clickhouse start_thread @ 0x76db in /lib/x86_64-linux-gnu/libpthread-2.27.so __clone @ 0x12171f in /lib/x86_64-linux-gnu/libc-2.27.so

jiangjiguang avatar Sep 15 '21 03:09 jiangjiguang

Checkout if your jdbc URL contains port.

sundy-li avatar Sep 15 '21 04:09 sundy-li

URL contains port, the code is same, when one thread write data to clickhouse, it succeed. But when two thread write data to clickhouse, there is the error

jiangjiguang avatar Sep 15 '21 04:09 jiangjiguang

You may need two connections if you have 2 threads write on parallel.

sundy-li avatar Sep 15 '21 06:09 sundy-li

@jiangjiguang using a DataSource with built-in Connection Pool might eliminate these kinda mistakes like HikariCP

andy1xx8 avatar Sep 15 '21 09:09 andy1xx8