Column Index out of range, 2 > 1  列索引的范围,2 > 1。这个问题是进行数据库查询的时候出现的。

因为查询sql语句时 只查询了 name

然后while 的时候 加了了一个password,于是就报错了,解决办法,在sql中添加password就可以解决。

    try {
conn =DBUtil.Open();
System.out.println("成功加载驱动连接");
String sql = "select name ,password from login";
stat = conn.createStatement();
System.out.println("成功建立数据库的连接");
rs = stat.executeQuery(sql);
while(rs.next()) {
String name = rs.getString(1);
String password = rs.getString(2);
System.out.println(name+","+password);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

Column Index out of range, 2 > 1 列索引的范围,2 > 1。的更多相关文章

  1. java.sql.SQLException:Column Index out of range,0<1

    1.错误描述 java.sql.SQLException:Column Index out of range,0<1 2.错误原因 try { Class.forName("com.m ...

  2. Android 模糊搜索rawquery bind or column index out of range: handle 0x2fb180 报错

    做模糊搜索时,出现了  bind or column index out of range: handle 0x2fb180 报错 public Cursor getTitle(String word ...

  3. Mabatis错误--Parameter index out of range

    昨天遇到一个错误,之前也遇到过,但是之前遇到很快就解决了,昨天遇到这个错误当时看了大概10来分钟,还是没搞好,今天才来搞好了. 错误信息如下 08:34:43,302 DEBUG getTeacher ...

  4. Parameter index out of range (2 > number of parameters, which is 1)

    今天在实现一个功能时遇到一个问题,解决了很久.结果是#{}与${}使用错误的原因.但是具体原因还不是很清楚,写此篇总结,知道的可以交流. 具体描述为:通过教师的头衔(1高级讲师2首席讲师)及名称进行模 ...

  5. ChIP-seq Peak caller MACS index out of range问题解决

    使用MACS1.4 进行peak calling的时候发现一个比较奇怪的问题: 我的某些文件无法被MACS1.4 进行peak calling,出现如下的信息: Traceback (most rec ...

  6. Caused by: java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0

    1.错误描述 [ERROR:]2015-05-05 16:35:50,664 [异常拦截] org.hibernate.exception.GenericJDBCException: error ex ...

  7. mybatis中Parameter index out of range (1 > number of parameters, which is 0).

    Parameter index out of range (1 > number of parameters, which is 0).(参数索引超出范围) 在mybatis里面写就是应该是 l ...

  8. java.sql.SQLException: Parameter index out of range (3 > number of parameters, which is 2).

    java.sql.SQLException: Parameter index out of range (3 > number of parameters, which is 2). java. ...

  9. java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).

    java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0). at co ...

随机推荐

  1. 批量插入bulkcopy

     public static void InsertBatch<T>(IDbConnection conn, IEnumerable<T> entityList, string ...

  2. [EXP]XAMPP 5.6.8 - SQL Injection / Persistent Cross-Site Scripting

    <!-- # Exploit Title: SQL injection (and previous) # Date: -- # Exploit Author: Rafael Pedrero # ...

  3. python numpy安装

    一.python下的numpy安装方法 第一步:安装python,这里不做介绍. 第二步:打开cmd看python是否安装成功. 第三步:输入 python -m pip install -U pip ...

  4. Linux学习笔记之十一————Linux常用服务器构建之ssh和scp

    一.ssh 1.ssh介绍 SSH为Secure Shell的缩写,由 IETF 的网络工作小组(Network Working Group)所制定:SSH 为建立在应用层和传输层基础上的安全协议. ...

  5. PHP官方网站及PHP手册

    每个人都知道php.net,我们或早或晚的都会来到这里并不断的访问它.它是PHPer的主要参考网站,拥有大量有用的信息,但是这些信息却不是那么显而易见. 比较有用的官方PHP资源: PHP官方函数手册 ...

  6. 深入学习卷积神经网络(CNN)的原理知识

    网上关于卷积神经网络的相关知识以及数不胜数,所以本文在学习了前人的博客和知乎,在别人博客的基础上整理的知识点,便于自己理解,以后复习也可以常看看,但是如果侵犯到哪位大神的权利,请联系小编,谢谢.好了下 ...

  7. DenseNet 论文阅读笔记

    Densely Connected Convolutional Networks 原文链接 摘要 研究表明,如果卷积网络在接近输入和接近输出地层之间包含较短地连接,那么,该网络可以显著地加深,变得更精 ...

  8. RockChip RK3326 系统编译问题总结

    1. 序言 本文主要记录了RK3326平台系统编译过程中遇到的各种问题,并加以解决! 环境: 宿主Linux:Ubuntu 16.04 目标机:RK3326 (64bit) Toolchain:gcc ...

  9. [转]bootstrapValidator.js 做表单验证

    本文转自:https://www.cnblogs.com/nele/p/5493414.html 作者:@nele本文为作者原创,转载请注明出处:https://www.cnblogs.com/nel ...

  10. 转载 基于JAVA每月运势api调用代码实例

    代码描述:基于JAVA每月运势api调用代码实例 接口地址:http://www.juhe.cn/docs/api/id/58 原文链接:http://outofmemory.cn/code-snip ...