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

when run the below code on netbeans it gives "not connected BUILD SUCCESSFUL (total time: 0 seconds)  RSS feed

 
nonkfu geraldine
Greenhorn
Posts: 5
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Henry Wong
author
Sheriff
Posts: 23275
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

It may really help, if you print out the exception, along with the stacktrace, instead of just "not connected".  Having more information for debugging generally helps.

Henry
 
nonkfu geraldine
Greenhorn
Posts: 5
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is all it gives henry
 
Henry Wong
author
Sheriff
Posts: 23275
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nonkfu geraldine wrote:That is all it gives henry


I know that is the only output.

You need to modify your program to print out the exception, and the stacktrace.

Henry
 
nonkfu geraldine
Greenhorn
Posts: 5
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry, i am a beginner henry so do actually understand you
 
Dave Tolls
Ranch Hand
Posts: 2809
30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When handling an exception in a catch block, like you are, it is often a good idea to call printStackTrace() on the exception, unless you are using a logging system of some sort in which case call the log method that takes an excpetion as an argument and it will do the work for you.
 
Campbell Ritchie
Sheriff
Posts: 55292
156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

Please have a look in the Java™ Tutorials about exceptions. If you can write a try‑catch, you shou‍ld know enough to be able to go through all the methods of the Exception class and find which is most suitable for this situation. Dave's suggestions sounds good.
Are you quite sure that is the correct path to your database?

Always use the code button; since you are new I have edited your post with it, and doesn't it look better I also removed excess blank lines, which do nothing for legibility. I presume “banala” isn't a “real” password.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!