当前位置:网站首页>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();边栏推荐
- The minimum number of operations to convert strings in leetcode simple problem
- Thinking about three cups of tea
- ucore lab6 调度器 实验报告
- The common methods of servlet context, session and request objects and the scope of storing data in servlet.
- [oiclass] share prizes
- The salary of testers is polarized. How to become an automated test with a monthly salary of 20K?
- STC-B学习板蜂鸣器播放音乐2.0
- Opencv recognition of face in image
- ByteDance ten years of experience, old bird, took more than half a year to sort out the software test interview questions
- Global and Chinese markets of electronic grade hexafluorobutadiene (C4F6) 2022-2028: Research Report on technology, participants, trends, market size and share
猜你喜欢
自动化测试你必须要弄懂的问题,精品总结

CSAPP Shell Lab 实验报告

CSAPP家庭作业答案7 8 9章

About the garbled code problem of superstar script
![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)
![[Ogg III] daily operation and maintenance: clean up archive logs, register Ogg process services, and regularly back up databases](/img/31/875b08d752ecd914f4e727e561adbd.jpg)
[Ogg III] daily operation and maintenance: clean up archive logs, register Ogg process services, and regularly back up databases

Sleep quality today 81 points

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

Install and run tensorflow object detection API video object recognition system of Google open source

"If life is just like the first sight" -- risc-v
随机推荐
[pointer] octal to decimal
Leetcode simple question: check whether two strings are almost equal
Differences between select, poll and epoll in i/o multiplexing
Contest3145 - the 37th game of 2021 freshman individual training match_ A: Prizes
C language do while loop classic Level 2 questions
Logstack introduction and deployment -- elasticstack (elk) work notes 019
Mysql的事务
Global and Chinese market of DVD recorders 2022-2028: Research Report on technology, participants, trends, market size and share
软件测试行业的未来趋势及规划
Vysor uses WiFi wireless connection for screen projection_ Operate the mobile phone on the computer_ Wireless debugging -- uniapp native development 008
全网最详细的postman接口测试教程,一篇文章满足你
Fundamentals of digital circuits (II) logic algebra
To brush the video, it's better to see if you have mastered these interview questions. Slowly accumulating a monthly income of more than 10000 is not a dream.
自动化测试你必须要弄懂的问题,精品总结
Stc-b learning board buzzer plays music
Database monitoring SQL execution
The maximum number of words in the sentence of leetcode simple question
Query method of database multi table link
CSAPP Shell Lab 实验报告
Eigen User Guide (Introduction)