English 中文(简体)
ResultSetImpl sediments Null Pointer 例外
原标题:ResultSetImpl throws NullPointerException

i m running mysql 5.5 with mysql 5.1.18 connector. a simple query of style

<0> 编码>从我的桌子(aaa , bbb ,...)和b=1栏()。

在java申请中执行。 查询结果为25千分之八。 阅读时的成绩

while(rs.next())
{
    MyObject c= new MyObject();  
    c.setA(rs.getString("A"));
    c.setB(rs.getString("B"));
    c.setC(rs.getString("C"));
    ...
}

a 以下例外情形通常在第一 lo期间,但从未在同一行:

java.lang.NullPointerException
    at com.mysql.jdbc.ResultSetImpl.getStringInternal(ResultSetImpl.java:5720)
    at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5570)
    at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5610)

i 研究了ResultSetImpl.java:5720的源代码,并参看:

switch (metadata.getSQLType())

元数据

Field metadata = this.fields[internalColumnIndex];

and getSQLType is a logic-less getter returning an int. what s interesting, is that the same metadata object is called numerous times several lines above with other getters, and throws no exceptions.

btw, there is no problem with the query above while ran directly within mysql. application runs in aws.

any ideas how to solve this? thanks.

问题回答

我在谈到这一问题时使用了春天数据十字储存库,从一个MySql数据库中提取了成果,该数据库在AWS RDS上运行,并经过适度的整合。

在大约30千伏之后,它还会向一个非决定性的流扔。

我以“交易”一词来解决这一问题。

虽然你不再使用日本邮局,但为你的数据库提供交易可能有助于你的问题。

从我的经验来看,这一错误是在试图在同一张桌旁同时读/做成时的一张锁桌造成的。 你们需要在每一次行动之间增加一个小组,以应付每一项要求或一些等待时间。

Related answer as well: Getting java.sql.SQLException: Operation not allowed after ResultSet closed





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...

热门标签