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 0000000000000000000000000000000000000000..35410cacdc5e87f985c93a96520f5e11a5c822e4 --- /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 0000000000000000000000000000000000000000..129a84ffd949074e65f024cc81027be051cfca9f --- /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 0000000000000000000000000000000000000000..aa00ffab7828f4818589659c804ec2cfd99baed3 --- /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 0000000000000000000000000000000000000000..abb532ab355ddfa5ec01bd4393fcda38f88224b0 --- /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 0000000000000000000000000000000000000000..132404bc29da2535f7f7dde84180d85abc60d5a4 --- /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 0000000000000000000000000000000000000000..2b63946d5b31084bbb7dda418ceb3d75eb686373 --- /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 0000000000000000000000000000000000000000..ab3c97c68786c19b424facc45ffaa7c5727c23a1 --- /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 0000000000000000000000000000000000000000..378ef9edbd54440f53e7b5343fa977aeb0867bf1 --- /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 0000000000000000000000000000000000000000..407f157bcb0852a527a500994d9e16a54f520f3f --- /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