Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem using JDBC connection in NetBeans IDE

 
Nikhil Reddy Lingala
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all..
I have gone through FAQ's section. But I have not found any answer for my problem, so I am posting it here.
I am able to connect to the Oracle database using a "hello world" kind of program(like able to retrieve the data from a table in the database). But the problem is when I am trying to develop a small login application using JSP and Servlets, I am unable to connect. I am doing this application through Sun NetBeans 5.5 IDE. I have included the .jar(ojdbc14.jar) file in the libraries of my project. But still I am unable to connect to the database.
I have put that "connection" code in a try-catch block and the code I have written in catch block is getting executed.
How do I resolve my problem?
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a stacktrace or other information you have on the exception which is being thrown?
 
Nikhil Reddy Lingala
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, I didn't include any code to print the stack trace..
I have just written a println statement that prints "error in this connection.java"

try{
//code for connecting database, which worked when tried with a simple
//program without using IDE
}catch(Exception e){
System.out.prinln("excetion in connection.java");
}

 
Herman Schelti
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

then MAKE it print the stacktrace.

If you print the same message for all exceptions, it won't give you any usefull information.

Herman
 
Nikhil Reddy Lingala
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes... I have given

e.printStackTrace();

to provide me the info wanted.. I was able to debug....
the problem was with the URL in the getConnection() method...!!!
 
sruthi das
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have you imported classes12.jar file.
I too had same kind of problems.when I imported that jar my problem solved.
tell me which exception you got.
 
sruthi das
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have you imported classes12.jar file.
I too had same kind of problems.when I imported that jar my problem solved.
tell me which exception you got.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic