当前位置:网站首页>MySQL - SQL injection problem
MySQL - SQL injection problem
2022-07-03 21:03:00 【Can't learn java】
List of articles
1、SQL Injection problem
- SQL Vulnerability , Can be attacked and result in data leakage
2、PreparedStatement object
PreparedStatement Can prevent SQL Inject , More efficient
package demo; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.Date; public class TestInsert01 { public static void main( String[] args ) { Connection conn = null; PreparedStatement st= null; try { conn=JdbcUtils.getConnection(); // Use ? Instead of parameters String sql ="INSERT\tINTO users(`id`,`NAME`,`PASSWORD`,`email`,`birthday`) VALUES(?,?,?,?,?)"; st = conn.prepareStatement(sql); // Assign parameters manually st.setInt(1,5); st.setString(2,"Java be unable to learn how to do sth. "); st.setString(3,"123456"); st.setString(4,"[email protected]"); st.setDate(5,new java.sql.Date(new Date().getTime())); // perform int i = st.executeUpdate(); if(i>0){ System.out.println(" Insert the success !"); } } catch (SQLException e) { e.printStackTrace(); }finally { JdbcUtils.release(conn,st,null); } } }
边栏推荐
- QT6 QML book/qt quick 3d/ Basics
- How to set the system volume programmatically- How to programmatically set the system volume?
- Transformation between yaml, Jason and Dict
- What is the maximum number of concurrent TCP connections for a server? 65535?
- 19、 MySQL -- SQL statements and queries
- Shortest path problem of graph theory (acwing template)
- Offset related concepts + drag modal box case
- Q&A:Transformer, Bert, ELMO, GPT, VIT
- 上周内容回顾
- Kernel symbol table
猜你喜欢
Is it OK for fresh students to change careers to do software testing? The senior answered with his own experience
Install and use Chrony, and then build your own time server
9 pyqt5 qscrollarea scroll area and qscrollbar scroll bar
Yyds dry goods inventory TCP & UDP
Example of peanut shell inner net penetration
The global industrial design revenue in 2021 was about $44360 million, and it is expected to reach $62720 million in 2028. From 2022 to 2028, the CAGR was 5.5%
From the behind the scenes arena of the ice and snow event, see how digital builders can ensure large-scale events
Introduction to golang garbage collection
【愚公系列】2022年7月 Go教学课程 002-Go语言环境安装
"Designer universe" argument: Data Optimization in the design field ultimately falls on cost, safety and health | chinabrand.com org
随机推荐
Scientific research document management Zotero
Single page application architecture
Brief analysis of ref nerf
MySQL master-slave synchronization principle
Study diary: February 14th, 2022
11-grom-v2-05-initialization
"Actbert" Baidu & Sydney University of technology proposed actbert to learn the global and local video text representation, which is effective in five video text tasks
上周内容回顾
全网都在疯传的《老板管理手册》(转)
Service discovery and load balancing mechanism -service
Install and use Chrony, and then build your own time server
2022 safety officer-c certificate examination and safety officer-c certificate registration examination
Basic number theory -- Chinese remainder theorem
Introduction to golang garbage collection
How to handle wechat circle of friends marketing activities and share production and release skills
Thread, thread stack, method stack, the difference of creating thread
设计电商秒杀系统
淺析 Ref-NeRF
Is flush account opening and registration safe and reliable? Is there any risk?
Phpexcel import export