Rishi Saraf
Rishi Saraf

Reputation: 1812

Not able to query to two different cassandra cluster in same app

I created cassandra session for two separate cluster using datastax driver in one java application. Session got created successfully however when I query, query on first cluster (pick any one) get executed successfully however query on second cluster always fails with below error. Please help me resolving this issue.

com.datastax.driver.core.exceptions.DriverInternalError: Tried to execute unknown prepared query 0x5f318143588bfa8c5deb2245224cf2da

Note: I have requirement to connect to two separate cluster in same app. Please don't ask why.

Upvotes: 0

Views: 310

Answers (1)

adutra
adutra

Reputation: 4536

From the stack trace, it is likely that you are trying to execute on session 1 a BoundStatement that belongs to session 2. PreparedStatement and BoundStatement instances can only be used with the session that created them. In your situation, you will need to prepare each statement you plan to use in your application on both sessions.

Upvotes: 1

Related Questions