Solved

JDBC connection problem ...

Posted on 1998-08-26
4
193 Views
Last Modified: 2010-03-30
I am trying to connect to an oracle database using the function
DriverManager.getConnection ("jdbc:oracle:thin:@(description=(address=(host=hostname)(protocol=tcp)(port=1521))(connect_data=(sid=oraclesid)))", "user", "pass");

I get an error saying connection refused!!

Any suggestions on why this might happen ...

Thanks
0
Comment
Question by:aswinmajj
4 Comments
 
LVL 1

Expert Comment

by:Sieger
ID: 1222632
Have you try port 1526 as well?
0
 
LVL 8

Expert Comment

by:diakov
ID: 1222633
I believe it will be usefull to ask the system administrator to look into the error logs files of the oracle server machine. There might be an indication of the problem the way Oracle sees it.
0
 

Accepted Solution

by:
santhu083198 earned 50 total points
ID: 1222634
The most probable reason is the port no is wrong.
1. make sure there is an sid,in your case, oraclesid.
2. open the tnsnames.ora file. There will be details about all sids here.
3.Find the record for your sid.
4.You can see the host, protocol, port info in this record.

use these values in your connect statement.

Hope this will help

0
 

Expert Comment

by:keoktay
ID: 1222635
Hi,

Could it be one of the following :
1) Your database server is behind a firewall ?
2) You are trying to make a connection using an applet instead of a application ?
3) You have not register your oracle driver using
     Class.forName ("oracle.jdbc.driver.OracleDriver");  ?
4) You are using Personal Oracle ?

Regards,
Keok Tay
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question