Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
檀越@新空间
elasticsearch-demo
提交
055c0541
E
elasticsearch-demo
项目概览
檀越@新空间
/
elasticsearch-demo
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
elasticsearch-demo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
055c0541
编写于
5月 13, 2023
作者:
檀越@新空间
🐭
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:jdbc-api
上级
c5c6ec5a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
44 addition
and
5 deletion
+44
-5
pom.xml
pom.xml
+11
-5
src/test/java/es_05_jdbc/TestJdbc.java
src/test/java/es_05_jdbc/TestJdbc.java
+33
-0
未找到文件。
pom.xml
浏览文件 @
055c0541
...
...
@@ -3,16 +3,13 @@
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
org.example
</groupId>
<artifactId>
elasticsearch-demo
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<properties>
<maven.compiler.source>
8
</maven.compiler.source>
<maven.compiler.target>
8
</maven.compiler.target>
</properties>
<dependencies>
<!--es客户端-->
<dependency>
...
...
@@ -31,7 +28,6 @@
<artifactId>
elasticsearch
</artifactId>
<version>
7.3.0
</version>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter
</artifactId>
...
...
@@ -48,6 +44,16 @@
<artifactId>
lombok
</artifactId>
<version>
1.16.10
</version>
</dependency>
<dependency>
<groupId>
org.elasticsearch.plugin
</groupId>
<artifactId>
x-pack-sql-jdbc
</artifactId>
<version>
7.3.0
</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>
elastic.co
</id>
<url>
https://artifacts.elastic.co/maven
</url>
</repository>
</repositories>
</project>
\ No newline at end of file
src/test/java/es_05_jdbc/TestJdbc.java
0 → 100644
浏览文件 @
055c0541
package
es_05_jdbc
;
import
java.sql.*
;
/**
* es sql功能
*
* @author : qinyingjie
* @version : 2.2.0
* @date : 2023/5/13 21:07
*/
public
class
TestJdbc
{
public
static
void
main
(
String
[]
args
)
{
//1创建连接
try
{
Connection
connection
=
DriverManager
.
getConnection
(
"jdbc:es://http://localhost:9200"
);
//2创建statement
Statement
statement
=
connection
.
createStatement
();
//3执行sql语句
ResultSet
resultSet
=
statement
.
executeQuery
(
"SELECT * FROM tvs"
);
//4获取结果
while
(
resultSet
.
next
())
{
System
.
out
.
println
(
resultSet
.
getString
(
1
));
System
.
out
.
println
(
resultSet
.
getString
(
2
));
System
.
out
.
println
(
resultSet
.
getString
(
3
));
System
.
out
.
println
(
resultSet
.
getString
(
4
));
System
.
out
.
println
(
"======================================"
);
}
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录