1 Star 0 Fork 3

allan_chan / redis-jdbc

forked from 大目 / redis-jdbc 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

README

一个基于Jedis的Redis JDBC驱动。

URL:

特性

  • 支持单节点Redis与Redis Cluster
  • 支持所有Jedis支持的命令
  • 支持在Intellij IDEA database console中连接Redis
  • 支持基于JDBC的ORM框架,例如Mybatis、Hibernate等

使用

在项目中添加如下依赖:

<dependency>
    <groupId>com.itmuch.redis</groupId>
    <artifactId>redis-jdbc</artifactId>
    <version>0.0.1</version>
</dependency>

Redis

Class.forName("com.itmuch.redis.jdbc.redis.RedisDriver");

Connection connection = DriverManager.getConnection(
  "jdbc:redis://localhost:6379/0",
  properties
);
Statement statement = connection.createStatement();

connection.setSchema("11");
ResultSet rs = statement.executeQuery("get a");
while (rs.next()) {
  String string = rs.getString(0);
  System.out.println(string);
}

其中,properties中的key可如下表所示:

key defaultValue description
user null the user of Redis
password null the password of user
ssl false whether to use ssl
timeout 1000 Jedis timeout

Redis Cluster

Class.forName("com.itmuch.redis.jdbc.cluster.RedisClusterDriver");

Connection connection = DriverManager.getConnection(
  "jdbc:redis-cluster:///localhost:6379;localhost:6380;localhost:6381",
  properties
);
Statement statement = connection.createStatement();

connection.setSchema("11");
ResultSet rs = statement.executeQuery("get a");
while (rs.next()) {
  String string = rs.getString(0);
  System.out.println(string);
}

其中,properties可如下表所示:

key defaultValue description
user null the user of Redis
password null the password of user
ssl false whether to use ssl
timeout 1000 Jedis timeout
maxAttempts 5 Jedis maxAttempts

空文件

简介

A JDBC Driver for Redis which is based on Jedis. 展开 收起
Java
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/allan_chan/redis-jdbc.git
git@gitee.com:allan_chan/redis-jdbc.git
allan_chan
redis-jdbc
redis-jdbc
main

搜索帮助