File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and Relational Databases and the fly likes Connection to an Oracle database fails Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Connection to an Oracle database fails" Watch "Connection to an Oracle database fails" New topic
Author

Connection to an Oracle database fails

Peter Hammar
Ranch Hand

Joined: Mar 01, 2010
Posts: 34
This is in my properties file:







I only get my Something is wrong message. Do I need anything more then the above?

Regards
H
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2531
    
  10

Why don't you print the exception message? "Something is wrong" does not give us a lot of info.
You don't show us where and how you create the connection.


OCUP UML fundamental and ITIL foundation
youtube channel
Peter Hammar
Ranch Hand

Joined: Mar 01, 2010
Posts: 34
I get this from printstacktrace:



The connection?

Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2531
    
  10

The exception tells you at what line of the code the error is.
Note: it is a general Java issue (a null pointer exception), not a database issue.
Peter Hammar
Ranch Hand

Joined: Mar 01, 2010
Posts: 34
The application runs fine if I run it in offline mode; no database connection. The errors are thrown when trying to connect to the database.

Line of code that it don't like when in online mode:



= at pall.PaLLmeny.<init>(PaLLmeny.java:80)

Thoughts?
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2531
    
  10

Peter Hammar wrote:...

Thoughts?
Some variable is null, and something in your code does not like that that variable is null.
Karthik Jayachandran
Ranch Hand

Joined: Feb 18, 2009
Posts: 90

If you are using an IDE like Eclipse, use the debugger. You will know where the exception is throwing.
 
 
subject: Connection to an Oracle database fails