ing-bank / cassandra-jdbc-wrapper

A JDBC wrapper of Java Driver for Apache Cassandra®, which offers a simple JDBC compliant API to work with CQL3.
Apache License 2.0
74 stars 25 forks source link

Allow connecting with DcInferringLoadBalancingPolicy instead of localdatacenter #49

Closed kornilova203 closed 11 months ago

kornilova203 commented 11 months ago

How to reproduce

Try connecting without specifying localdatacenter but with specifying DcInferringLoadBalancingPolicy which should discover localdatacenter automatically jdbc:cassandra://localhost:9046/?loadBalancing=DcInferringLoadBalancingPolicy

Expected result

Successful connection

Actual result

Confusing error No node was available to execute the query

Problem

localdatacenter is set to an empty string

Solution

Do not set localdatacenter if it was not specified. If user set loadBalancing then connection will be successful. If user didn't set loadBalancing then at least they'll see the correct error message Since you provided explicit contact points, the local DC must be explicitly set

kornilova203 commented 11 months ago

Sure, no problem