2 Star 1 Fork 0

风中的思念Y / sqldog

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

sqldog

English | 中文

sqldog 是一款 Java 开发的简易关系型数据库,支持内存和硬盘存储模式,支持以下功能

  • DML SQL(simple)
  • DDL SQL
  • SELECT
  • CLI
  • JPA (Hibernate) dialect, Mybatis PageHelper, SpringData-JDBC 自动适配

注意:仅用于开发和学习使用,切勿用于生产环境

使用说明

嵌入版

  • 引入 JDBC 和 server 依赖
  1. maven
<dependency>
    <groupId>com.yuanzhy.sqldog</groupId>
    <artifactId>sqldog-jdbc</artifactId>
    <version>0.1.1</version>
</dependency>
<dependency>
    <groupId>com.yuanzhy.sqldog</groupId>
    <artifactId>sqldog-server</artifactId>
    <version>0.1.1</version>
</dependency>
  1. gradle
dependencies {
    implementation "com.yuanzhy.sqldog:sqldog-jdbc:0.1.1"
    implementation "com.yuanzhy.sqldog:sqldog-server:0.1.1"
}
  • 配置jdbc
  1. 内存模式(数据存储在jvm内存中)
url=jdbc:sqldog:mem
driver-class=com.yuanzhy.sqldog.jdbc.Driver
  1. 文件模式(数据存储在配置的目录中)
url=jdbc:sqldog:file:/home/test/data
driver-class=com.yuanzhy.sqldog.jdbc.Driver

独立版

安装

  1. 安装JDK8+并配置环境变量
  2. 将安装包解压到任意目录
  3. 将 bin 目录配置到环境变量
  4. 根据需要修改配置文件 server/sqldog.properties,配置说明如下
  • server.storage.mode:存储模式,可选项“disk”、“memory”
  • server.storage.writeCache:是否开启写缓存,开启后可大幅提升写入速度,数据会延迟落盘,可靠性降低(仅disk模式生效)
  • server.storage.path:数据存储路径,可配置相对路径或绝对路径,为相对路径则相对于sqldog安装目录(仅disk模式生效)
  • server.storage.codec:元数据编码方式
  • server.host:绑定IP
  • server.port:绑定端口
  • server.username:用户名
  • server.password:密码
  • server.max-connections:最大连接数

修改配置后启动服务

dql-server

命令行

  • 查看帮助
dsql --help
  • 连接本机
dsql -U [username] -p [password]
  • 列出所有模式
show schemas
  • 查看当前所在模式
show search_path
  • 切换模式
use [schema_name]
# or
set search_path to [schema_name]
  • 列出当前模式所有表
show tables
  • 查看表信息
desc [table_name]
# or
\d [table_name]
  • 退出命令行
quit
# or
exit
# or
\q

JDBC

  • 引入 JDBC 依赖
  1. maven
<dependency>
    <groupId>com.yuanzhy.sqldog</groupId>
    <artifactId>sqldog-jdbc</artifactId>
    <version>0.1.1</version>
</dependency>
  1. gradle
dependencies {
    implementation "com.yuanzhy.sqldog:sqldog-jdbc:0.1.1"
}
  • 配置jdbc
url=jdbc:sqldog://127.0.0.1[:2345][/schema_name]
user=root
password=123456
driver-class=com.yuanzhy.sqldog.jdbc.Driver

维护者

@yuanzhy

使用许可

MIT © yuanzhy

MIT License Copyright (c) 2022 yuanzhy Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

一款 Java 开发的数据库 展开 收起
Java 等 3 种语言
MIT
取消

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/yuanzhy/sqldog.git
git@gitee.com:yuanzhy/sqldog.git
yuanzhy
sqldog
sqldog
master

搜索帮助