Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / February 2007

Tip: Looking for answers? Try searching our database.

Cannot connect to one Oracle DB using JDBC

Thread view: 
davis@sqlmagic.com - 01 Feb 2007 18:43 GMT
I have looked through the postings but cannot get a handle on this.  I
have connected to many Oracle databases in many environments using
JDBC but there is one that I cannot connect to.  I have the Oracle
client tools installed and I can connect using SQL*Plus using the Host
String PRODLAW.

The tnsnames.ora entry looks like this;
PRODLAW =
 (DESCRIPTION =
   (ADDRESS_LIST =
     (ADDRESS = (PROTOCOL = TCP)(HOST = db4.netaspx.com)(PORT =
1521))
     (ADDRESS = (PROTOCOL = TCP)(HOST = db5.netaspx.com)(PORT =
1521))
     (LOAD_BALANCE = yes)
   )
   (CONNECT_DATA =
     (SERVICE_NAME = c0ujP0.oracle.netaspx.com)
     (FAILOVER_MODE =
       (TYPE = SELECT)
       (METHOD = BASIC)
     )
   )
 )

The sqlnet.ora looks like this

# sqlnet.ora Network Configuration File: D:\Oracle\product
\10.1.0\Client_1\network\admin\sqlnet.ora
# Generated by Oracle configuration tools.

SQLNET.AUTHENTICATION_SERVICES= (NTS)

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

The message I am getting looks like this

Driver: oracle.jdbc.driver.OracleDriver
Connecting to jdbc:oracle:thin:@db5.netaspx.com:1521:c0ujP0...
Driver registered: oracle.jdbc.driver.OracleDriver
Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=169869824)
(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))

I CAN successfully connect to another instance defined in the same way
in the same environment.  Only this one particular dadtabase
connection fails.

Any ideas would be very much appreciated.
David Harper - 01 Feb 2007 19:16 GMT
[SNIP]
> The message I am getting looks like this
>
[quoted text clipped - 3 lines]
> Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=169869824)
> (ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))

I have a strange feeling of déja vu.  We had similar questions in this
newsgroup back in September and October last year.  Here'swhat I said
back then:

Oracle error code 12505 means "TNS:listener could not resolve SID given
in connect descriptor".

Apparently, this means that the TNS listener service does not recognise
the service ID which you specified in your JDBC connection URL.  Perhaps
you gave the wrong service ID?  Or perhaps the Oracle instance has not
registered that service ID with the TNS listener?

Caveat: I'm *not* an Oracle expert!

David Harper
Cambridge, England
Alfred - 04 Feb 2007 08:32 GMT
> ...
> The message I am getting looks like this
>
> Driver: oracle.jdbc.driver.OracleDriver
> Connecting to jdbc:oracle:thin:@db5.netaspx.com:1521:c0ujP0...

With Thin driver you connect directly to Oracle's
SQL listener. In this case tnsnames.ora is useless.
The connection string has to be ended with System
Identifier of your Oracle instance - not with service
name or service id. The Oracle SID is the unique name
of instance/database of your Oracle installation.

Alfred
kuassi.mensah@gmail.com - 05 Feb 2007 17:52 GMT
On Feb 1, 10:43 am, d...@sqlmagic.com wrote:
> I have looked through the postings but cannot get a handle on this.  I
> have connected to many Oracle databases in many environments using
[quoted text clipped - 44 lines]
>
> Any ideas would be very much appreciated.

Hi,

Starting with 10.2, JDBC-Thin supports TNSNAMES provided you specify
the location (directory) by setting oracle.net.tns_admin as follows:

java -Doracle.net.tns_admin=$ORACLE_HOME/network/admin
or:
System.setProperty("oracle.net.tns_admin", "c:\oracle\net\admin");

Kuassi http://db360.blogpspot.com


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.