• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.sql.SQLException: After end of result set

 
Fred Pepin
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Thanks but I found the problem...
Frederic
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic