Fred Pepin

Greenhorn
+ Follow
since Mar 08, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Fred Pepin

Thanks but I found the problem...
Frederic
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