This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Problem using JDBC connection in NetBeans IDE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Problem using JDBC connection in NetBeans IDE" Watch "Problem using JDBC connection in NetBeans IDE" New topic
Author

Problem using JDBC connection in NetBeans IDE

Nikhil Reddy Lingala
Greenhorn

Joined: Dec 06, 2007
Posts: 15
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

Joined: Sep 29, 2002
Posts: 1683
Is there a stacktrace or other information you have on the exception which is being thrown?


SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Nikhil Reddy Lingala
Greenhorn

Joined: Dec 06, 2007
Posts: 15
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

Joined: Jul 17, 2006
Posts: 387
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

Joined: Dec 06, 2007
Posts: 15
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

Joined: Dec 28, 2007
Posts: 34
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

Joined: Dec 28, 2007
Posts: 34
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.
 
wood burning stoves
 
subject: Problem using JDBC connection in NetBeans IDE
 
Similar Threads
DriverManager.getConnection hangs from actionPerformed
Mysql and connection refused
NetBeans and MySQL
java.net.ConnectException: Connection refused: connect
problem in connecting sql 2005