java.lang.NullPointerException on imbricated queries

From: Olivier BULLAT <Olivier(dot)Bullat(at)ifma(dot)fr>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: java.lang.NullPointerException on imbricated queries
Date: 2003-06-30 08:59:09
Message-ID: 5.0.2.1.2.20030630103241.0186ed60@mail.ifma.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

<html>
<font face="Courier New, Courier">Hello,<br>
&nbsp;<br>
We </font>have a web application in Apache, Posgresql 7.2, servlet java
(JDK 1.2), Jserv and jdbc7.2dev-1.2.jar. <br>
A lot of programs runs normally with JDBC access to postgresql. But when
we use two imbricated queries like this example, a message
<font face="Courier New, Courier">JAVALANGEXEPTION
java.lang.NullPointerException occurs</font>:<br>
<br>
<font face="Courier New, Courier">1<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Query1
= </font><font face="Courier New, Courier" color="#00CB00">&quot;SELECT *
FROM example1;&quot;</font><font face="Courier New, Courier">;<br>
2<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>rs1 =
stmt.executeQuery(Query1);<br>
3<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab></font><font face="Courier New, Courier" color="#941EDF">while</font><font face="Courier New, Courier">
(rs1.next()) {<br>
4<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Query2
= </font><font face="Courier New, Courier" color="#00CB00">&quot;SELECT *
FROM example2;<br>
</font><font face="Courier New, Courier">5<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>rs2
= stmt.executeQuery(Query2);<br>
6<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab></font><font face="Courier New, Courier" color="#941EDF">while</font><font face="Courier New, Courier">
(rs2.next()) {<br>
7<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>//
Something .../...<br>
8<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>}<br>
9<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>}<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br>
<br>
Programme DetailsRapports.java: JAVALANGEXEPTION
java.lang.NullPointerException: <br>
java.lang.NullPointerException: <br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>at
org.postgresql.jdbc2.ResultSet.next(ResultSet.java:113)<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>at
DetailsRapports.AfficheEntrees(DetailsRapports.java:68)<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>at
DetailsRapports.service(DetailsRapports.java:43)<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>at
javax.servlet.http.HttpServlet.service(HttpServlet.java:588)<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>at
org.apache.jserv.JServConnection.processRequest(JServConnection.java:317)<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>at
org.apache.jserv.JServConnection.run(JServConnection.java:188)<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>at
java.lang.Thread.run(Thread.java:479)<br>
<br>
This message occurs on line 3
&quot;</font><font face="Courier New, Courier" color="#941EDF">while</font><font face="Courier New, Courier">
(rs1.next()) {&quot; after a first good Query1 and a first good
Query2.<br>
<br>
Any help would be appreciated.<br>
<br>
<br>
</font><x-sigsep><p></x-sigsep>
--------------------------------------------------------------------------<br>
Olivier BULLAT<br>
Responsable du Centre de Ressources Informatiques<br>
Institut Francais de Mecanique Avancee - IFMA<br>
Campus de CLERMONT-FERRAND / Les Cezeaux<br>
BP 265<br>
63175 AUBIERE Cedex<br>
Tel:&nbsp;&nbsp; 04.73.28.80.35<br>
Fax:&nbsp; 04.73.28.81.00<br>
mail: <font color="#0000FF"><u>Olivier(dot)Bullat(at)ifma(dot)fr<br>
<a href="http://www.ifma.fr/" eudora="autourl">http://www.ifma.fr</a><br>
</u></font>--------------------------------------------------------------------------
</html>

Attachment Content-Type Size
unknown_filename text/html 4.0 KB

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kallol Nandi 2003-06-30 09:06:54 Re: java.lang.NullPointerException on imbricated queries
Previous Message Kris Jurka 2003-06-29 11:22:04 Re: [PATCHES] IPv6 patch doesn't work fine