当前位置:网站首页>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); } } }
边栏推荐
- Qtablewidget control of QT
- How to choose cache read / write strategies in different business scenarios?
- Read the root directory of the folder, write txt and generate random samples
- The "boss management manual" that is wildly spread all over the network (turn)
- @Scenario of transactional annotation invalidation
- Qualcomm platform WiFi -- P2P issue
- jvm jni 及 pvm pybind11 大批量数据传输及优化
- Go learning notes (4) basic types and statements (3)
- Cannot load driver class: com. mysql. cj. jdbc. Driver
- Pytorch sets the weight and bias of the model to zero
猜你喜欢
The "boss management manual" that is wildly spread all over the network (turn)
QT6 QML book/qt quick 3d/ Basics
Hcie security Day11: preliminarily learn the concepts of firewall dual machine hot standby and vgmp
Borui data and Sina Finance released the 2021 credit card industry development report
SQL injection - Fundamentals of SQL database operation
Link aggregation based on team mechanism
Etcd 基于Raft的一致性保证
Experience summary of database storage selection
你真的知道自己多大了吗?
Task of gradle learning
随机推荐
String and+
Preliminary practice of niuke.com (11)
Producer consumer mode (multithreading, use of shared resources)
MySQL——规范数据库设计
Task of gradle learning
MySQL dump - exclude some table data - MySQL dump - exclude some table data
Research Report on the overall scale, major manufacturers, major regions, products and application segmentation of rotary tablet presses in the global market in 2022
Hcie security Day10: six experiments to understand VRRP and reliability
不同业务场景该如何选择缓存的读写策略?
抓包整理外篇——————autoResponder、composer 、statistics [ 三]
[Yugong series] go teaching course 002 go language environment installation in July 2022
2022 low voltage electrician examination and low voltage electrician simulation examination question bank
SQL injection - Fundamentals of SQL database operation
Sort out several network request methods of JS -- get rid of callback hell
Getting started with postman -- environment variables and global variables
Offset related concepts + drag modal box case
thrift go
Advanced collaboration: coroutinecontext
How to modify the network IP addresses of mobile phones and computers?
Reinforcement learning - learning notes 1 | basic concepts