当前位置:网站首页>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();边栏推荐
- 基于485总线的评分系统双机实验报告
- Thinking about three cups of tea
- Daily code 300 lines learning notes day 9
- Heap, stack, queue
- Face and eye recognition based on OpenCV's own model
- What is an index in MySQL? What kinds of indexes are commonly used? Under what circumstances will the index fail?
- Zhejiang University Edition "C language programming experiment and exercise guide (3rd Edition)" topic set
- Pedestrian re identification (Reid) - data set description market-1501
- Logstack introduction and deployment -- elasticstack (elk) work notes 019
- How to rename multiple folders and add unified new content to folder names
猜你喜欢
自动化测试你必须要弄懂的问题,精品总结

Pedestrian re identification (Reid) - Overview

CSAPP家庭作业答案7 8 9章

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

Leetcode simple question: check whether the numbers in the sentence are increasing
![Cadence physical library lef file syntax learning [continuous update]](/img/0b/75a4ac2649508857468d9b37703a27.jpg)
Cadence physical library lef file syntax learning [continuous update]

Sorting odd and even subscripts respectively for leetcode simple problem

Maximum nesting depth of parentheses in leetcode simple questions
![Transplant hummingbird e203 core to Da Vinci pro35t [Jichuang xinlai risc-v Cup] (I)](/img/85/d6b196f22b60ad5003f73eb8d8a908.png)
Transplant hummingbird e203 core to Da Vinci pro35t [Jichuang xinlai risc-v Cup] (I)

1. Payment system
随机推荐
MySQL数据库(一)
Vysor uses WiFi wireless connection for screen projection_ Operate the mobile phone on the computer_ Wireless debugging -- uniapp native development 008
What is the transaction of MySQL? What is dirty reading and what is unreal reading? Not repeatable?
Currently, mysql5.6 is used. Which version would you like to upgrade to?
Stc-b learning board buzzer plays music
Global and Chinese market of pinhole glossmeter 2022-2028: Research Report on technology, participants, trends, market size and share
Express
Face and eye recognition based on OpenCV's own model
Wang Shuang's detailed learning notes of assembly language II: registers
Using flask_ Whooshalchemyplus Jieba realizes global search of flask
Report on the double computer experiment of scoring system based on 485 bus
The four connection methods of JDBC are directly coded
Summary of thread implementation
UCORE lab8 file system experiment report
接口测试面试题及参考答案,轻松拿捏面试官
CSAPP Shell Lab 实验报告
[Ogg III] daily operation and maintenance: clean up archive logs, register Ogg process services, and regularly back up databases
Es full text index
Heap, stack, queue
Wang Shuang's detailed notes on assembly language learning I: basic knowledge