Solved

JDBC connection problem ...

Posted on 1998-08-26
4
201 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MySqlDump not dumping triggers 1 43
Tomcat: Unable to run tomcat service. 2 23
Crystal Reports Licensing Questions 4 36
American Express @Work site and Java 4 29
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

831 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