当前位置:网站首页>Preparedstatement principle of preventing SQL injection
Preparedstatement principle of preventing SQL injection
2022-06-25 03:46:00 【Stupid in the food】
1. PreparedStatement And Statement What is it for ?
PreparedStatement and Statement All right sql Statement and returns the compiled identifier .
2. PreparedStatement The advantages of ?
1. Effectively prevent sql Inject .
2. precompile , Than statement High execution efficiency ( Compile multiple times at a time )
3. Good readability of parameter settings .
3. What is? sql Inject ?
The user enters malicious in the front page sql sentence , Cheat the server to execute malicious sql Code , Cause database leakage , This is it. sql Inject . for example :
select * from user where name = ‘${name}’
If the parameter Zhang San is passed in ’ or 1=’1, The user can get all the data without knowing the name .
4. PrepareStatement How to prevent sql Injected ?
PrepareStatement Each character of the parameter will be traversed , Line break found 、 quotes 、 Special characters such as slashes , Will be escaped . Above after escape sql Injection will fail .
Before escape :select * from user where name = ‘ Zhang San ’ or 1=’1’;
After escaping : select * from user where name = ‘ Zhang San \’ or 1 = \’1’;
obviously , After the escape sql Statement query result is null . Unless there is a wonderful flower named “ Zhang San ’ or 1 = ’1”.
reference : prevent sql Principle of injection
边栏推荐
- 在线股票开户安全吗?
- 孙武玩《魔兽》?有图有真相
- AI自己写代码让智能体进化!OpenAI的大模型有“人类思想”那味了
- Is it reliable for CITIC Securities to open a mobile account? Is it safe?
- Easynvr fails to use onvif to detect the device. What is the reason why "no data" is displayed?
- Demonstration of combination of dream CAD cloud map and GIS
- Is flush a regular platform? Is it safe for flush to open an account
- ICML 2022 | ByteDance AI Lab proposes a multimodal model: x-vlm, learning multi granularity alignment of vision and language
- ASP. Net conference room booking applet source code booking applet source code
- Google founder brin's second marriage broke up: it was revealed that he had filed for divorce from his Chinese wife in January, and his current fortune is $631.4 billion
猜你喜欢

Amazon's other side in China

Seata四大模式之TCC模式详解及代码实现

Collaboration + Security + storage, cloud box helps Shenzhen edetai restructure its data center

AI writes its own code to let agents evolve! The big model of openai has the flavor of "human thought"

How to raise key issues in the big talk club?

騰訊開源項目「應龍」成Apache頂級項目:前身長期服務微信支付,能hold住百萬億級數據流處理...

Apple's legendary design team disbanded after jobs refused to obey cook

AI越进化越跟人类大脑像!Meta找到了机器的“前额叶皮层”,AI学者和神经科学家都惊了...

服乔布斯不服库克,苹果传奇设计团队解散内幕曝光

Rebeco: using machine learning to predict stock crash risk
随机推荐
Sleep more, you can lose weight. According to the latest research from the University of Chicago, sleeping more than 1 hour a day is equivalent to eating less than one fried chicken leg
Tutoriel d'installation MySQL
【Rust投稿】从零实现消息中间件(6)-CLIENT
China's SkyEye found suspicious signals of extraterrestrial civilization. Musk said that the Starship began its orbital test flight in July. Netinfo office: app should not force users to agree to proc
The era of copilot free is over! Student party and defenders of popular open source projects can prostitute for nothing
西电AI专业排名超清北,南大蝉联全国第一 | 2022软科中国大学专业排名
MySQL modifies and deletes tables in batches according to the table prefix
大咖说*计算讲谈社|如何提出关键问题?
Three key explanations of overseas e-commerce operation in 2022
Peking University has a new president! Gongqihuang, academician of the Chinese Academy of Sciences, took over and was admitted to the Physics Department of Peking University at the age of 15
你真的需要自动化测试吗?
发布功能完成02《ivx低代码签到系统制作》
Sorting of poor cattle (winter vacation daily question 40)
做自媒体不知道怎样变现?7大变现方法分享
Does it count as staying up late to sleep at 2:00 and get up at 10:00? Unless you can do it every day
Standing at the center of the storm: how to change the engine of Tencent
Is it safe to open an account with flush securities?
When people look at the industrial Internet from the Internet like thinking and perspective, they have actually fallen into a dead end
現在,耳朵也要進入元宇宙了
js工具函数,自己封装一个节流函数