This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Statement execute method fails  RSS feed

 
Samson Mlati
Ranch Hand
Posts: 41
Hibernate Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

} 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.
 
Samson Mlati
Ranch Hand
Posts: 41
Hibernate Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2632
17
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And, what is the result if you try to run the statement "SELECT locationId * FROM locations " in your database's query tool?
 
Samson Mlati
Ranch Hand
Posts: 41
Hibernate Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!