Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to select database? #79

Closed
tunctolgahan opened this issue May 17, 2022 · 5 comments
Closed

How to select database? #79

tunctolgahan opened this issue May 17, 2022 · 5 comments

Comments

@tunctolgahan
Copy link

Hi,
I cannot select the db, how would it be possible?

@sazzad16
Copy link
Collaborator

From #78 (comment)

You can create your own JedisPool using a constructor with database param and pass that JedisPool in JRedisTimeseries constructor.

@LiorKogan
Copy link
Member

@tunctolgahan
Copy link
Author

tunctolgahan commented May 17, 2022

From #78 (comment)

You can create your own JedisPool using a constructor with database param and pass that JedisPool in JRedisTimeseries constructor.

Hi,
I already have a Jedis client used by non-time series data stored on Redis. I am getting its config by help of this line
GenericObjectPoolConfig<Jedis> jedisConfig = ((JedisConnectionFactory) stringRedisTemplate.getConnectionFactory()).getPoolConfig();

and create JedisPool object and RedisTimeSeries object

        JedisPool pool = new JedisPool(jedisConfig, host);
        RedisTimeSeries redisTimeSeries = new RedisTimeSeries(pool);

But I see different database (0) selected in RedisTimeSeries object when I debug - my actual jedis client's database is 13

@sazzad16
Copy link
Collaborator

@tunctolgahan new JedisPool(jedisConfig, host) constructor does not contain database or db param.

In case you missed,

... using a constructor with database param ...

@tunctolgahan
Copy link
Author

Thanks very much! I was thinking that all the configs (host, pass, db, etc) I set for my actual Jedis client would be passing to JedisPool object because I give GenericObjectPoolConfig object to it. My fault. :)

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants