java中使用如下代码做数据库连接,用以查询数据
*******************我是分割线*************************************
try {
Class.forName("com.mysql.jdbc.Driver");
String connectionUrl = "jdbc:mysql://127.0.0.1:3306/base_company";
conn = DriverManager.getConnection(connectionUrl,"root","root");
stmt = conn.createStatement();
String sqlString="SELECT count(1) as trueorfalse from base_user where usercode='"+name+"' and password='"+pwd+"';";
System.out.println(sqlString);
rs=stmt.executeQuery(sqlString);
while(rs.next())
{
result=rs.getString("trueorfalse");
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
 
*******************我是分割线*********************************************
 
缺少红色文字部分就会出现 java.sql.SQLException: Before start of result set异常,原因貌似是因为到了最后一条记录

解决 java.sql.SQLException: Before start of result set的更多相关文章

  1. java.sql.SQLException: Before start of result set解决方法

    java.sql.SQLException: Before start of result set解决方法 今天做东西的时候发现这个错误,查了查,特地记下来,以后开始积累了 哈哈 解决发法是: 使用r ...

  2. java中mysql查询报错java.sql.SQLException: Before start of result set

    异常:java.sql.SQLException: Before start of result set 解决方法:使用rs.getString();前一定要加上rs.next(); sm = con ...

  3. java.sql.SQLException: Before start of result set

    在使用JDBC查询数据库报了这么一个错误 CREATE TABLE `d_user` ( `id` int(10) NOT NULL, `name` varchar(10) DEFAULT NULL, ...

  4. 【java.sql.SQLException: Before start of result set】

    将ResultSet转换为 Map<String,String>时抛出了一个这样的异常:java.sql.SQLException: Before start of result set ...

  5. 解决java.sql.SQLException: ORA-01789: query block has incorrect number of result columns

    java.sql.SQLException: ORA-01789: query block has incorrect number of result columns at oracle.jdbc. ...

  6. 解决java.sql.SQLException: Parameter number X is not an OUT parameter--转

    最近独自一个人写项目,孤军奋战的程序猿可真伤不起! Java 调用MYSQL带输入输出参数存储过程时如题错误:java.sql.SQLException: Parameter number X is ...

  7. 解决java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone

    使用spring boot整合MySQL时一直报 java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecog ...

  8. 解决java.sql.SQLException: Incorrect string value: '\xE6\x88\x91\xE7\x9A\x84...' for column 'groupName'

    今天使用mysql,用java程序往mysql中写数据,出现如下错误: Caused by: java.sql.SQLException: Incorrect string value: '\xD3\ ...

  9. 在交互环境下使用 Pyspark 提交任务给 Spark 解决 : java.sql.SQLException: No suitable driver

    在 jupyter 上启用 local 交互环境和 spark 进行交互使用 imapla 来帮助 spark 取数据却失败了 from pyspark.sql import SparkSession ...

随机推荐

  1. python拼接

    拼接: name=zhuhuan age=23 salary=333 info=''' ----- info of %s----- age:%s name:%s salary:%s %(name,ag ...

  2. CodeForces Round #521 (Div.3) A. Frog Jumping

    http://codeforces.com/contest/1077/problem/A A frog is currently at the point 00 on a coordinate axi ...

  3. ruby linux连接windows执行dos命令

    在整个开发流程中,gitlab-runner-ci是搭建在linux下.web自动化是在windows下面进行的. 如果ci构建完版本.部署完后,需要触发启动自动化执行. 那么我们需要在部署完后在li ...

  4. 【bzoj3277/bzoj3473】串/字符串 广义后缀自动机

    题目描述 字符串是oi界常考的问题.现在给定你n个字符串,询问每个字符串有多少子串(不包括空串)是所有n个字符串中至少k个字符串的子串(注意包括本身). 输入 第一行两个整数n,k.接下来n行每行一个 ...

  5. CMake 使用笔记

    记录 CMake 相关知识. Prelude:读文档一定要有耐心! 问题一 CLion: CMakeLists.txt 中 set(CMAKE_CXX_FLAGS -Wall) 不起作用 Soluti ...

  6. BZOJ-2618 [CQOI2006]凸多边形

    半平面交模版题.. #include <cstdlib> #include <cstdio> #include <cmath> #include <cstri ...

  7. SQL中GETDATE()一些操作

    Sql Server 中一个非常强大的日期格式化函数Select CONVERT(varchar(100), GETDATE(), 0): 05 16 2006 10:57AMSelect CONVE ...

  8. bzoj2115【WC2011】XOR

    题意:http://www.lydsy.com/JudgeOnline/problem.php?id=2115 sol  :首先考虑处理出DFS树,那么树上的所有非树边可以构成一个简单环 因为所有不在 ...

  9. bzoj3609【HEOI2014】人人尽说江南好

    题意:http://www.lydsy.com/JudgeOnline/problem.php?id=3609 sol :博弈论  通过打表找规律,发现答案是%m循环的,且当m为偶数时取反  因为我太 ...

  10. jQuery 之 验证表单

    简单的东西重复做,做多了之后,才能说熟能生巧. 做好一个精美的页面,固然是好,但是,一个页面除了写好之外,我们更需要的是将其功能完善.比如表单的验证,这只是众多工作之一.然后本次就以jQuery的va ...