From 64467d88ac6de18f4a69cb6944dca9df5b4f9452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E5=91=A8=E7=86=A0?= <2108439463@qq.com> Date: Thu, 5 Dec 2024 17:38:39 +0800 Subject: [PATCH] 12/5 --- .../lesson01/.idea/.gitignore" | 8 ++ .../lesson01/.idea/compiler.xml" | 15 +++ .../lesson01/.idea/encodings.xml" | 7 + .../lesson01/.idea/jarRepositories.xml" | 20 +++ .../lesson01/.idea/misc.xml" | 14 ++ .../lesson01/.idea/uiDesigner.xml" | 124 ++++++++++++++++++ .../23 20241205 maven/lesson01/pom.xml" | 26 ++++ .../lesson01/src/main/java/mdd.java" | 47 +++++++ .../src/main/java/org/example/Main.java" | 7 + 9 files changed, 268 insertions(+) create mode 100644 "\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/.idea/.gitignore" create mode 100644 "\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/.idea/compiler.xml" create mode 100644 "\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/.idea/encodings.xml" create mode 100644 "\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/.idea/jarRepositories.xml" create mode 100644 "\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/.idea/misc.xml" create mode 100644 "\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/.idea/uiDesigner.xml" create mode 100644 "\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/pom.xml" create mode 100644 "\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/src/main/java/mdd.java" create mode 100644 "\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/src/main/java/org/example/Main.java" diff --git "a/\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/.idea/.gitignore" "b/\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/.idea/.gitignore" new file mode 100644 index 0000000..35410ca --- /dev/null +++ "b/\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/.idea/.gitignore" @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git "a/\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/.idea/compiler.xml" "b/\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/.idea/compiler.xml" new file mode 100644 index 0000000..129a84f --- /dev/null +++ "b/\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/.idea/compiler.xml" @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/.idea/encodings.xml" "b/\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/.idea/encodings.xml" new file mode 100644 index 0000000..aa00ffa --- /dev/null +++ "b/\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/.idea/encodings.xml" @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git "a/\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/.idea/jarRepositories.xml" "b/\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/.idea/jarRepositories.xml" new file mode 100644 index 0000000..abb532a --- /dev/null +++ "b/\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/.idea/jarRepositories.xml" @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git "a/\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/.idea/misc.xml" "b/\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/.idea/misc.xml" new file mode 100644 index 0000000..132404b --- /dev/null +++ "b/\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/.idea/misc.xml" @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git "a/\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/.idea/uiDesigner.xml" "b/\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/.idea/uiDesigner.xml" new file mode 100644 index 0000000..2b63946 --- /dev/null +++ "b/\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/.idea/uiDesigner.xml" @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/pom.xml" "b/\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/pom.xml" new file mode 100644 index 0000000..ab3c97c --- /dev/null +++ "b/\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/pom.xml" @@ -0,0 +1,26 @@ + + + 4.0.0 + + org.example + lesson01 + 1.0-SNAPSHOT + + + 8 + 8 + UTF-8 + + + + + com.mysql + mysql-connector-j + 8.3.0 + + + + + \ No newline at end of file diff --git "a/\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/src/main/java/mdd.java" "b/\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/src/main/java/mdd.java" new file mode 100644 index 0000000..378ef9e --- /dev/null +++ "b/\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/src/main/java/mdd.java" @@ -0,0 +1,47 @@ +import java.sql.*; + +public class mdd { + + public static void main(String[] args) throws ClassNotFoundException, SQLException { + Class.forName("com.mysql.cj.jdbc.Driver"); + // 创建连接 + String url = "jdbc:mysql://localhost:3306/student?useSSL=false&useUnicode=true&characterEncoding=utf8"; + String username = "root"; + String password = "123456"; + Connection conn = DriverManager.getConnection(url, username, password); + // 创建stmt对象 + Statement stmt = conn.createStatement(); + + String select = "select * from student"; + ResultSet rs = stmt.executeQuery(select); + // 返回结果 +// if (rs.next()) { + while (rs.next()) { + int stuId = rs.getInt("s_id"); + String name = rs.getString("s_name"); + String birth = rs.getString("s_birth"); + String sex = rs.getString("s_sex"); + System.out.println(stuId + "\t" + name + "\t" + sex+ "\t" + birth); + } + + } +} + +//数据库代码 +// +// CREATE DATABASE student; +// +// CREATE TABLE student1( +// s_id INT NOT NULL , +// s_name VARCHAR(255) NOT NULL, +// s_birth VARCHAR(255) NOT NULL, +// s_sex VARCHAR(2) NOT NULL +// +// +// ); +// +// +// INSERT INTO `student1` (`s_id`, `s_name`, `s_birth`, `s_sex`) VALUES (1, '老大', '2020-12-02', '1'); +// INSERT INTO `student1` (`s_id`, `s_name`, `s_birth`, `s_sex`) VALUES (2, '老二', '2022-12-02', '1'); +// INSERT INTO `student1` (`s_id`, `s_name`, `s_birth`, `s_sex`) VALUES (3, '老三', '2022-12-02', '1'); +// INSERT INTO `student1` (`s_id`, `s_name`, `s_birth`, `s_sex`) VALUES (4, '老四', '2022-12-02', '2'); diff --git "a/\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/src/main/java/org/example/Main.java" "b/\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/src/main/java/org/example/Main.java" new file mode 100644 index 0000000..407f157 --- /dev/null +++ "b/\347\275\227\345\221\250\347\206\240/23 20241205 maven/lesson01/src/main/java/org/example/Main.java" @@ -0,0 +1,7 @@ +package org.example; + +public class Main { + public static void main(String[] args) { + System.out.println("Hello world!"); + } +} \ No newline at end of file -- Gitee