当前位置:网站首页>Error in Android connection database query statement
Error in Android connection database query statement
2022-06-24 19:51:00 【CSDN Q & A】
The phenomenon and background of the problem
Error in Android connection database query statement
Problem related code , Do not paste screenshots
Class.forName(driverName); //jdk edition 6.0 This sentence can be omitted from the above con= DriverManager.getConnection(dbURL,userName,userPwd); String sql="select * from Manager where _id = "+_id; Statement st=con.createStatement(); if(st.executeQuery(sql)!=null) { Log.d(" The connection fails ","?"); } ResultSet rs=st.executeQuery(sql); Log.d(" Inquire about id success ",rs.getString("_id")); while(rs.next()){ if(rs.getString("_id").equals(_id)&&rs.getString("psd").equals(password)){ result="1"; Log.d(" Login successful ","success"); break;}
Operation results and error reporting contents
Test connection statement yes , The query statement is not empty , But the user name cannot be found , The second problem log doesn't come out


My solution ideas and tried methods
Changed the database _id data type , The test data I use is 01
Also try adding single quotes
What I want to achieve
Want to know why the query statement is wrong
Take the answer :
if(st.executeQuery(sql)!=null) { Log.d(" The connection fails ","?"); } Change it to try { if(con== null || con.isClosed()) { conn = DriverManager.getConnection(url, user, password); } }catch(Exception ex) { ex.printStackTrace(); }边栏推荐
- IP address to integer
- 对国产数据库厂商提几个关于SQL引擎的小需求
- Multi segment curve temperature control FB (SCL program) of PLC function block series
- Test drive citus 11.0 beta (official blog)
- Teach you how to cancel computer hibernation
- MySQL binlog data source configuration document, please share
- The agile way? Is agile development really out of date?
- Some small requirements for SQL Engine for domestic database manufacturers
- NFT双币质押流动性挖矿系统开发
- Zadig + cave Iast: let safety dissolve in continuous delivery
猜你喜欢

Obstacle avoidance sensor module (stm32f103c8t6)

微信小程序轮播图怎么自定义光标位置

制造业项目MDM主数据项目实施心得

Camera module and hardware interface of Camera1 camera

程序员大部分时间不是写代码,而是。。。

Confirm whether the host is a large terminal or a small terminal

【Go語言刷題篇】Go從0到入門4:切片的高級用法、初級複習與Map入門學習

php OSS文件读取和写入文件,workerman生成临时文件并输出浏览器下载

Audio and video 2020 2021 2022 basic operation and parameter setting graphic tutorial

Some small requirements for SQL Engine for domestic database manufacturers
随机推荐
php OSS文件读取和写入文件,workerman生成临时文件并输出浏览器下载
Multi cloud mode is not a "master key"
怎么使用R包ggtreeExtra绘制进化树
Unityshader world coordinates do not change with the model
Instruction rearrangement concept
Some small requirements for SQL Engine for domestic database manufacturers
Volcano becomes spark default batch scheduler
Power efficiency test
Making startup U disk -- Chinese cabbage U disk startup disk making tool V5.1
SQL export CSV data, unlimited number of entries
Server lease error in Hong Kong may lead to serious consequences
Unity移动端游戏性能优化简谱之 以引擎模块为划分的CPU耗时调优
Pingcap was selected as the "voice of customers" of Gartner cloud database in 2022, and won the highest score of "outstanding performer"
[R tidyverse] use of select verb
finkcdc支持sqlserver2008么?
实时渲染:实时、离线、云渲染、混合渲染的区别
Steering gear control (stm32f103c8t6)
想问下 pgsql cdc 账号同一个 多个 task 会有影响吗,我现在3个task 只有一个 有
Teach you how to cancel computer hibernation
Drawing DEM with GEE gracefully