当前位置:网站首页>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();
边栏推荐
- In Oracle, start with connect by prior recursive query is used to query multi-level subordinate employees.
- ucore lab5用户进程管理 实验报告
- Why can swing implement a form program by inheriting the JFrame class?
- What are the business processes and differences of the three basic business modes of Vos: direct dial, callback and semi direct dial?
- Opencv recognition of face in image
- Expanded polystyrene (EPS) global and Chinese markets 2022-2028: technology, participants, trends, market size and share Research Report
- [pointer] find the largest string
- [HCIA continuous update] working principle of static route and default route
- Pointer -- eliminate all numbers in the string
- Daily code 300 lines learning notes day 9
猜你喜欢
How to rename multiple folders and add unified new content to folder names
王爽汇编语言详细学习笔记二:寄存器
Install and run tensorflow object detection API video object recognition system of Google open source
MySQL数据库(一)
Software testing interview summary - common interview questions
ucore lab5用户进程管理 实验报告
Report on the double computer experiment of scoring system based on 485 bus
Fundamentals of digital circuits (III) encoder and decoder
Database monitoring SQL execution
Servlet
随机推荐
China's county life record: go upstairs to the Internet, go downstairs' code the Great Wall '
Global and Chinese markets of PIM analyzers 2022-2028: Research Report on technology, participants, trends, market size and share
If the position is absolute, touchablehighlight cannot be clicked - touchablehighlight not clickable if position absolute
CSAPP家庭作業答案7 8 9章
How to transform functional testing into automated testing?
pytest
The four connection methods of JDBC are directly coded
王爽汇编语言学习详细笔记一:基础知识
Eigen User Guide (Introduction)
How to solve the poor sound quality of Vos?
Portapack application development tutorial (XVII) nRF24L01 launch B
Brief description of compiler optimization level
Collection集合与Map集合
ucore lab1 系统软件启动过程 实验报告
STC-B学习板蜂鸣器播放音乐
[Ogg III] daily operation and maintenance: clean up archive logs, register Ogg process services, and regularly back up databases
Programmers, how to avoid invalid meetings?
Contest3145 - the 37th game of 2021 freshman individual training match_ A: Prizes
1. Payment system
Réponses aux devoirs du csapp 7 8 9