暂无图片
暂无图片
1
暂无图片
暂无图片
暂无图片

JimSQL:纯Java开发的文本数据库

原创 AI.+7 2022-06-25
1036

C 1.png

What is Jim

JimSql = Jim Isn’t MySQL. Jim is a filesystem database system implemention use Java.

Useage

use docker-compose to start a server

version: '3' services: jimsql: privileged: true image: dafei1288/jimsql_server:1.0.0 ports: - "8821:8821" - "8825:8825" # volumes: # - "./data:/jimsql/data" environment: # JAVA_OPTS: -agentlib:jdwp=transport=dt_socket,address=*:8825,server=y,suspend=n JAVA_ARGS: 8821 0.0.0.0 /jimsql/data

Use snapshot repository

<repositories> <repository> <id>jim</id> <url>https://oss.sonatype.org/content/repositories/snapshots</url> </repository> </repositories>

Then use jdbc to connect

<dependency> <groupId>com.dafei1288</groupId> <artifactId>jdbc</artifactId> <version>1.0.0-SNAPSHOT</version> </dependency>
import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.Statement; import java.util.ArrayList; import java.util.List; public class TestServer { public static void main(String[] args) throws Exception { Class.forName("com.dafei1288.jimsql.jdbc.JqDriver"); Connection conn = DriverManager.getConnection("jdbc:jimsql://localhost:8821/test"); System.out.println(conn); Statement statement = conn.createStatement(); System.out.println(statement); String sql = "select id,name from user"; ResultSet resultSet = statement.executeQuery(sql); System.out.println(sql); System.out.println(resultSet); while(resultSet.next()){ ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); List<String> colNames = new ArrayList<>(); for(int i=0;i<resultSetMetaData.getColumnCount();i++){ String colName = resultSetMetaData.getColumnLabel(i); System.out.println(colName+" => "+resultSet.getString(colName)); } System.out.println(); } } }
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论