今天是软工实习的第一天, 主要的任务有进行JDBC的相关测试, 并且开始学习Spring框架的相关内容. 由于我有一段时间没有接触Java相关内容了, 所以先大致过了一遍关键点, 找了下感觉, 然后将JDBC连接测试完成, 下面会给出部分关键步骤
JDBC连接相关
版本:
jdk1.8.0_251
MySql 5.7.29
MySql Connector/ODBC 5.1.30
只给出部分关键代码
jdbc.properties
url=jdbc:mysql://localhost:3306/sqltest?useUnicode=true&characterEncoding=utf-8
user=root
password=123456
drive=com.mysql.jdbc.Driver
jdbc_test
import java.sql.*;
import java.util.Scanner;
/**
* @Auther Jack
* @Date 2020/7/20
*/
public class jdbc_test {
public static void main(String[] args) throws ClassNotFoundException, SQLException {
/* Class.forName("com.mysql.jdbc.Driver");
//获取数据库连接对象
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/sqltest?useUnicode=true&characterEncoding=utf-8","root","654321");
String sql = "update jdbctable set name ='中文' where id = 2";
Statement statement = connection.createStatement();
int cout = statement.executeUpdate(sql);
System.out.println(cout);
statement.close();
connection.close();*/
Scanner sc =new Scanner(System.in);
System.out.println("请输入用户名:");
String username=sc.nextLine();
System.out.println("请输入密码:");
String password=sc.nextLine(