• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java.sql.SQLException: After end of result set

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I'm having a problem and I'm about to go insane.
I use Apache/Tomcat/4.1.12 and Connector/J 3.0.6 to connect to a MySQL 3.23.55 Database server.
For some very obscur reason, I'm getting an error on every second query using the same connection.
The weird part is that the same query crash on the second time too
Here's my code:
Connection conn = null;
try{
double radius = 5.0;
String zip = "20211";
radius = radius/69.1;
double latRef = 0.0;
double longRef = 0.0;
double latRefmR = 0.0;
double latRefpR = 0.0;
double longRefmR = 0.0;
double longRefpR = 0.0;
conn = ConnectionGenerator.getConnection();
Statement stmt = conn.createStatement();
ResultSet result = stmt.executeQuery(" SELECT zip_codes, zip_latitude, zip_longitude FROM zip_codes WHERE zip_codes ='"+ zip +"'");

if( result.next() )
{
latRef = result.getDouble(2);
longRef = result.getDouble(3);
latRefmR = latRef - radius;
latRefpR = latRef + radius;
longRefmR = longRef - radius;
longRefpR = longRef + radius;
}
result.close();
result = null;
stmt.close();
stmt = null;
stmt = conn.createStatement();
result = stmt.executeQuery("
SELECT zip_codes, zip_latitude, zip_longitude FROM zip_codes WHERE zip_codes ='"+ zip +"'");

while( result.next() );
{
//It crash here
result.getDouble("zip_codes");

}
result.close();
stmt.close();
conn.close();
}
catch(Exception eee)
{
eee.printStackTrace();
conn.close();
}
Any help would be greatly appreciated,
Frederic
 
Fred Pepin
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks but I found the problem...
Frederic
 
Drove my Chevy to the levee but the levee was dry. A wrung this tiny ad and it was still dry.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic