aspose file tools*
The moose likes JDBC and the fly likes Statement execute method fails Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Statement execute method fails" Watch "Statement execute method fails" New topic
Author

Statement execute method fails

Samson Mlati
Ranch Hand

Joined: Feb 23, 2009
Posts: 41

Hi guys,

I have a problem with the code below. When I trace the execution my code the while loop never executes. Immediately after statement.execute() it jumps to the end of the function. What am i doing wrong? Heres the function. Thanks in advance. I have in bold the last statement executed and the immediately next line.



Best,
Mlati
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


} catch (SQLException e) {

} catch (NamingException e) {

}

You are throwing away useful information. Print the stack trace and you will get a clue as to what is going wrong.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Samson Mlati
Ranch Hand

Joined: Feb 23, 2009
Posts: 41

Paul Sturrock wrote:

} catch (SQLException e) {

} catch (NamingException e) {

}

You are throwing away useful information. Print the stack trace and you will get a clue as to what is going wrong.



duuuhh... i should have done that. Thanks a tonne
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2510
    
  10

And, what is the result if you try to run the statement "SELECT locationId * FROM locations " in your database's query tool?


OCUP UML fundamental and ITIL foundation
youtube channel
Samson Mlati
Ranch Hand

Joined: Feb 23, 2009
Posts: 41

Jan Cumps wrote:And, what is the result if you try to run the statement "SELECT locationId * FROM locations " in your database's query tool?


I had i typo in the code above, the sql statement is wrong and I coulndn't see that cuz I wasnt printing the stack trace
 
Consider Paul's rocket mass heater.
 
subject: Statement execute method fails