当前位置:网站首页>JDBC introduction
JDBC introduction
2022-07-06 15:11:00 【Hand pluckable Xinchen】
1,JDBC Concept
Java Database Connectivity(JDBC):Java Access to the database solution .
JDBC Defines a set of interfaces , That is to access the general database API, Different database manufacturers implement these interfaces according to the characteristics of their respective databases .
JDBC You want to access different databases in the same way , Let the specific database operation have nothing to do with the implementation of the database manufacturer , Thus in
Easily switch between different databases .
2,JDBC Related class interface
Class.forName("com.mysql.cj.jdbc.Driver");String url = "jdbc:mysql://localhost:3306/dayone?serverTimezone=GMT";
String user = "root";
String pwd = "123456";
Connection conn = DriverManager.getConnection(url, user, pwd);String sql = "insert into student(sname,birthday,ssex,classid) values(' Zhang San ','2022-1-1',' male ','100')";
Statement statm = conn.createStatement();int ret = statm.executeUpdate(sql); // perform DML sentence ( add to , Delete , modify ), Return value int
//ResultSet rs = stmt.executeQuery(sql); // perform DQL sentence ( Inquire about ), Return value ResultSet
if(ret > 0) {
System.out.println(" Execution succeeded ");
}else {
System.out.println(" Execution failed ");
}(5) Release resources
statm.close();
conn.close();边栏推荐
- Four methods of exchanging the values of a and B
- Wang Shuang's detailed notes on assembly language learning I: basic knowledge
- Wang Shuang's detailed learning notes of assembly language II: registers
- Es full text index
- Keil5 MDK's formatting code tool and adding shortcuts
- “Hello IC World”
- Introduction to variable parameters
- 王爽汇编语言详细学习笔记二:寄存器
- [oiclass] share prizes
- Thinking about three cups of tea
猜你喜欢

Nest and merge new videos, and preset new video titles

软件测试Bug报告怎么写?

Capitalize the title of leetcode simple question

Stc-b learning board buzzer plays music 2.0

STC-B学习板蜂鸣器播放音乐

Daily code 300 lines learning notes day 9
软件测试方法有哪些?带你看点不一样的东西
软件测试需求分析之什么是“试纸测试”

Summary of thread implementation

How to rename multiple folders and add unified new content to folder names
随机推荐
C language do while loop classic Level 2 questions
Four methods of exchanging the values of a and B
Leetcode simple question: check whether the numbers in the sentence are increasing
基于485总线的评分系统双机实验报告
Public key box
MySQL数据库(二)DML数据操作语句和基本的DQL语句
[issue 18] share a Netease go experience
ucore lab7 同步互斥 实验报告
[Ogg III] daily operation and maintenance: clean up archive logs, register Ogg process services, and regularly back up databases
Global and Chinese market of maleic acid modified rosin esters 2022-2028: Research Report on technology, participants, trends, market size and share
Detailed introduction to dynamic programming (with examples)
软件测试行业的未来趋势及规划
The minimum number of operations to convert strings in leetcode simple problem
"If life is just like the first sight" -- risc-v
Statistics 8th Edition Jia Junping Chapter 4 Summary and after class exercise answers
DVWA exercise 05 file upload file upload
Emqtt distribution cluster and node bridge construction
ucore lab6 调度器 实验报告
How to use Moment. JS to check whether the current time is between 2 times
遇到程序员不修改bug时怎么办?我教你