• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 5
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is all it gives henry
 
Henry Wong
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry, i am a beginner henry so do actually understand you
 
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic