clickhouse-java icon indicating copy to clipboard operation
clickhouse-java copied to clipboard

Getting java.sql.SQLException: Unable to get connection: there are no enabled urls while creating connection

Open ashishguptaom opened this issue 5 years ago • 3 comments

In my project I have invoked scheduledActualization() while creating BalancedClickhouseDataSource which enable/disable urls in clickhouse cluster based on health check of node in cluster. Some time I am getting java.sql.SQLException: Unable to get connection: there are no enabled urls even though at that time all node in my clickhouse cluster were alive and was able to connect and execute query using clickhouse-client.

Current Behavior Getting below exception and issue getting resolved on application restart.

Expected Behavior url should be marked disable when node in cluster is not reachable and marked back as enabled when node in cluster reachable. It should not require application restart.

Code:

this.dataSource = new BalancedClickhouseDataSource(ds);
		
if (pingRateMilliSeconds > 0) {
	this.dataSource.scheduleActualization(10000, TimeUnit.MILLISECONDS);
}

Exception:

java.sql.SQLException: Unable to get connection: there are no enabled urls at ru.yandex.clickhouse.BalancedClickhouseDataSource.getAnyUrl(BalancedClickhouseDataSource.java:177) at ru.yandex.clickhouse.BalancedClickhouseDataSource.getConnection(BalancedClickhouseDataSource.java:194) at com.netcore.deferredpublisher.service.BalancedDSConnectionProvider.getConnection(BalancedDSConnectionProvider.java:56) at com.netcore.deferredpublisher.dao.NmiDeferredpublishtaskDao.getUnpublishedEvents(NmiDeferredpublishtaskDao.java:45) at com.netcore.deferredpublisher.dao.NmiDeferredpublishtaskDao$$FastClassBySpringCGLIB$$8aba1b5b.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139)

clickhouse-driver version <dependency> <groupId>ru.yandex.clickhouse</groupId> <artifactId>clickhouse-jdbc</artifactId> <version>0.1.54</version> </dependency>

clickhouse-server version 19.14.6

Please let me know do I need to specify any additional configuration to resolve above issue?

ashishguptaom avatar Oct 21 '20 11:10 ashishguptaom

I've got the same issue.

Caused by: java.sql.SQLException: Unable to get connection: there are no enabled urls
	at ru.yandex.clickhouse.BalancedClickhouseDataSource.getAnyUrl(BalancedClickhouseDataSource.java:180) ~[clickhouse-jdbc-0.3.2-patch11-all.jar:clickhouse-jdbc 0.3.2-patch11 (revision: 27f8951)]
	at ru.yandex.clickhouse.BalancedClickhouseDataSource.getConnection(BalancedClickhouseDataSource.java:205) ~[clickhouse-jdbc-0.3.2-patch11-all.jar:clickhouse-jdbc 0.3.2-patch11 (revision: 27f8951)]
	at ru.yandex.clickhouse.BalancedClickhouseDataSource.getConnection(BalancedClickhouseDataSource.java:29) ~[clickhouse-jdbc-0.3.2-patch11-all.jar:clickhouse-jdbc 0.3.2-patch11 (revision: 27f8951)]
	at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:364) ~[HikariCP-4.0.3.jar:?]
	at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206) ~[HikariCP-4.0.3.jar:?]
	at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:476) ~[HikariCP-4.0.3.jar:?]
	at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561) ~[HikariCP-4.0.3.jar:?]
	at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115) ~[HikariCP-4.0.3.jar:?]
	at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:81) ~[HikariCP-4.0.3.jar:?]

leiless avatar May 28 '24 02:05 leiless

Good day, @leiless ! Can you upgrade to later version?

Thanks!

chernser avatar Jun 18 '24 21:06 chernser

Ok, I'll try. Thanks!

leiless avatar Jun 19 '24 01:06 leiless

Should be fixed in the latest version. Please create a new issue if it is still present. Thanks!

chernser avatar Nov 14 '25 21:11 chernser