当前位置:网站首页>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(); }边栏推荐
- Making startup U disk -- Chinese cabbage U disk startup disk making tool V5.1
- Necessary fault handling system for enterprise network administrator
- 敏捷之道 | 敏捷开发真的过时了么?
- How to customize cursor position in wechat applet rotation chart
- Mq-2 smoke concentration sensor (STM32F103)
- Capacitive inching touch switch module control (stm32f103c8t6)
- SQL export CSV data, unlimited number of entries
- php OSS文件讀取和寫入文件,workerman生成臨時文件並輸出瀏覽器下載
- 目前是不是只cdc 监控mysql 可以拿到新增列的数据 sqlserver不行是吧
- thinkphp6中怎么使用jwt认证
猜你喜欢

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

试驾 Citus 11.0 beta(官方博客)

一文理解OpenStack网络

Install the custom module into the system and use find in the independent project_ Package found

What are the functions of IBPs open source form designer?

Camera module and hardware interface of Camera1 camera

Power supply noise analysis

Power efficiency test

Win7 10 tips for installing Office2010 five solutions for installing MSXML components

The efficiency of okcc call center data operation
随机推荐
Bytebase 加入阿里云 PolarDB 开源数据库社区
SQL export CSV data, unlimited number of entries
At present, only CDC monitors Mysql to get the data of new columns. Sqlserver can't, can it
Php OSS file read and write file, workerman Generate Temporary file and Output Browser Download
Buddha bless you that there will never be a bug
Confirm whether the host is a large terminal or a small terminal
Power efficiency test
Eureka source code shallow reading - automatic fault removal
What type of datetime in the CDC SQL table should be replaced
PingCAP 入选 2022 Gartner 云数据库“客户之声”,获评“卓越表现者”最高分
PHP OSS file reads and writes files, and workman generates temporary files and outputs them to the browser for download
R语言corrplot相关热图美化实例分析
Ls common parameters
制造业项目MDM主数据项目实施心得
Starring develops httpjson access point + Database
Experience of MDM master data project implementation for manufacturing projects
Vs2017 add header file path method
High dimension low code: component rendering sub component
The difference between the lazy man mode and the hungry man mode
Full link service tracking implementation scheme