Link to home
Start Free TrialLog in
Avatar of benson031397
benson031397

asked on

JDBC problem

Dear sir,

Can JDBC for Oracle8i support Oracle 8(8.0.5.x.x) also?

Benson
ASKER CERTIFIED SOLUTION
Avatar of k_murli_krishna
k_murli_krishna
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Dear Benson,
            Here is a follow up. The JDBC API which is an user interface for coding is automatically shipped with the installation and so are the drivers. If we use thin and oci type oracle based drivers for connectivity, then JDBC is not involved at all. Hope i am clear.

regards
( K. Murli Krishna )
Avatar of benson031397
benson031397

ASKER

Dear sir,

Actually, I got a problem in oracle JDBC problem.
Problem :

I am using the "Oracle8i 8.1.7.1 JDBC Drivers for use with JDK 1.2.x for Solaris" to write applications in B server.

And the oracle 8 is installed in the another server, called A server.

The following is the coding which connect to A server oracle8.
Con = DriverManager.getConnection("jdbc:oracle:thin:[IP Address]", "onebox", "onebox");

However, I cannot connect it.

The error message is :
java.sql.SQLException: Io exception: The Network Adapter could not establish the connection

Pls help.

Thanks!



Try the following steps from Metalink.

Doc ID:  Note:139775.1
Subject:  JDBC Connection Failure: Network adapter could not establish connection
Type:  PROBLEM
Status:  REVIEWED
 Content Type:  TEXT/PLAIN
Creation Date:  13-APR-2001
Last Revision Date:  11-JUL-2001
 

*************************************************************
This article is being delivered in Draft form and may contain
errors.  Please use the MetaLink "Feedback" button to advise
Oracle of any issues related to this article.
*************************************************************

PROBLEM
-------

You are attempting to connect to an Oracle instance using JDBC
and you are receiving the following error.

   java.sql.SQLException: Io exception:
     The Network Adapter could not establish connection

   SQLException: SQLState (null) vendor code (17002)

Any or all of the following other conditions may also apply:

1) You are able to establish a SQL*Plus connection from the same
   client to the same Oracle instance.

2) You are able to establish a JDBC OCI, but not Thin connection
   from the same client to the same Oracle instance.

3) The same JDBC application is able to connect from a different
   client to the same Oracle instance.

4) The same behavior applies whether the initial JDBC connection
   string specifies a hostname or an IP address.

REDISCOVERY
-----------

To verify whether you are hitting this problem, verify whether the
Oracle instance is configured for Multithreaded Server (MTS).

If the Oracle instance is not configured for MTS, you are probably
encountering a different problem. Otherwise, continue.

Try forcing the JDBC connection to use a dedicated server instead
of a shared server. This can be accomplished in several ways.

For JDBC OCI or Thin, this can be done by reconfiguring the server
for dedicated connections only. This approach, however, may not be
feasible in many cases. In such cases, the following options apply.

For JDBC OCI:

1) Add the (SERVER=DEDICATED) property to the TNS connect string
   stored in the tnsnames.ora file on the client.

2) Set the user_dedicated_server=ON in sqlnet.ora on the client.

For JDBC Thin:

You must specify a full name-value pair connect string (the same
as it might appear in the tnsnames.ora file) instead of the short
JDBC Thin syntax. For example, instead of

   "jdbc:oracle:thin:@host:port:sid"

you would need to use a string of the form

   "jdbc:oracle:thin:@(DESCRIPTION="                   +
                         "(ADDRESS_LIST="              +
                             "(ADDRESS=(PROTOCOL=TCP)" +
                                      "(HOST=host)"    +
                                      "(PORT=port)"    +
                             ")"                       +
                         ")"                           +
                         "(CONNECT_DATA="              +
                             "(SERVICE_NAME=sid)"      +
                             "(SERVER=DEDICATED)"      +
                         ")"                           +
                       ")"

If the connection works fine after having made these changes, it
is very likely that this is the problem you are encountering. In
this case, one last test will help to verify this fact.

Log into the remote host on which the Oracle instance is running
and execute the appropriate command to determine what the server
'thinks' its hostname is (i.e. the name that was configured when
the server was installed and configured). For example, on a Unix
host the 'hostname' command can be used for this purpose.

Using the name displayed (e.g. by the hostname command), exactly
as it appeared (i.e. if the output from the hostname command had
the domain name included, then include it), return to the client
which was unable to connect and try pinging the server.

NOTE: It is critical that you attempt to ping the server using
      EXACTLY the same hostname you got from the server.

If you are unable to ping the server via this hostname, then you
almost certainly hitting this problem. If not, this may be a new
issue, but at least you will have found a workaround (i.e. use a
dedicated connection).

EXPLANATION
-----------

To understand why this problem occurs, one must first understand
the differences in how the listener handles connections to shared
servers versus dedicated servers.

When connecting to a dedicated server, the client connects to the
listener (via hostname or IP address). The listener then spawns a
dedicated server process and hands off the socket used to accept
the client connection to that server. The client and server then
start communicating via the endpoints established by the initial
connection. NOTE: There is only one connection in this case.

When connecting to a shared server, the initial client connection
to the listener is the same. However, with MTS, there is no need
to spawn a new server process; a pool of shared processes already
exists. Also, clients do not communicate directly with the server
processes in MTS; rather, they communicate with a dispatcher.

For this reason, when setting up an MTS connection, the listener
sends a redirect message back to the client asking the client to
close the connection to the listener and connect to a dispatcher.
The information in this message includes the hostname and a port
number for the appropriate dispatcher. The redirect message will
ALWAYS specify a hostname, even if the client initially provided
an IP address.

If, for any reason, the hostname provided to the listener (e.g. by
the 'hostname' or another command) doesn't agree with the hostname
by which the server is known on the client, the connection fails.

On the other hand, if "(SERVER=DEDICATED)" already appears in the
TNS connect string in tnsnames.ora or if "use_dedicated_server=ON"
already appears in the sqlnet.ora file, you may find that SQL*Plus
and/or JDBC OCI work fine, while JDBC Thin fails.

SOLUTION
--------

Obviously, one solution is to use dedicated servers. However, this
may not always be feasible.

The key is to make sure the hostname on both the client and server
agree. This can be accomplished by reconfiguring either the client
or the server, but there are things to be aware of in both cases.

If the server is configured to return a different hostname, then it
is possible that other clients which used to work will now fail.

In some cases, it may not be feasible to reconfigure the client. For
example, if the server version of the hostname does not include the
domain, you would need to remove the domain portion of the hostname
on the client; but, if the client needs to connect to more than one
server with the same base name in different domains, this may not be
possible, as the hostname may be ambiguous.

ADDENDUM
--------

As of the time of this writing, another problem which results in the
same error is under investigation. In this case, JDBC connections to
an MTS server fail if the client has a static IP address, but do not
fail if the client is configured via DHCP. Using a dedicated server
corrects the problem in this case as well, though the reasons for
this are not yet clear.

 
mathavra:

Thank you very much indeed.  It is a very clear solution.

However, to summarize,

To make the connect string simple as

jdbc:oracle:thin:[IP Address]", "onebox", "onebox"

is to make the oracle instance as dedicated server.

that's it?  right?


Benson
mathavra,

I have tried the connect string which you suggest, I got another error message :

java.sql.SQLException: Io exception: Connection refused(DESCRIPT
ION=(TMP=)(VSNNUM=134238208)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))
))


Can u help me to interpret what the problem is?


Thanks!

Benson
The error stands for "TNS:listener could not resolve SID given in connect descriptor". Can you double check whether your SID is set right (ORACLE_SID). Also, double check the SID is registered in the listener.

-Mathav
Hi,
     Check the service name in the init<sid>.ora file and
give the same in the listener and in the tnsnames.ora file(jdbc conenct string).

      To check whether the listener is reacheable from u'r client u can run the TNSPING utility from the client as
TNSPING <service_name> from the DOS
Hi,
     Check the service name in the init<sid>.ora file and
give the same in the listener and in the tnsnames.ora file(jdbc conenct string).

      To check whether the listener is reacheable from u'r client u can run the TNSPING utility from the client as
TNSPING <service_name> from the DOS prompt and it will show whether the listner is reachable.

Hope this will help to reduce u'r search area.

thanks
selva
benson--->  You have asked 128 questions here and only graded/finalized 94 of them.  These are all your open questions here, please update and finalize them all.  Administration has been advised. In addition, 10 of them have been unresolved due to -1 userid conditions, which resulted from jsp-500 errors of that time, which are being manually corrected.  To quickly navigate through all your open/locked questions, click your Member Profile and expand your question history.

If you need help to special handle any of these open questions, comment with details here or post a zero point question in the Community Support topic area with the QID (link).  The HELP DESK contains the Guidelines/Member Agreement and the Q/A process detail.

Experts, please comment with closing recommendations if these items remain open by the end of this week, so we can finalize them.

 
 Win Prog. Exchange Client Application 50 Open 01/07/2001
 Linux Net. Mount Point Setup 50 Open 02/12/2001
 Apache file execution in Apache 50 Open 03/08/2001
 Java Serialized Java Object 50 Open 03/17/2001
 Java Java Compiling Error 50 Open 03/27/2001
 Web Tools iPlanet Problem! 50 Open 03/29/2001
 Oracle About Oracle 9i IAS problem. 50 Open 04/08/2001
 Oracle Download Oracle8i (8.1.6) for Intel Linux. 50 Open 04/10/2001
 Java Segmentation Fault in jdk1.2.2 on linux Platform 50 Open 04/25/2001
 Linux Net. eth0 checksum error 50 Open 04/25/2001
 Oracle sqlplus problem 50 Open 05/04/2001
 Vignette About Vignette 10 Open 03/07/2001
 Apache Apache and JSP 50 Open 09/08/2000
 Java KVM and CVM 50 Open 05/31/2001
 MS Site Server Java service provider for MS site server 50 Open 06/07/2001
 Oracle pro*c compiler in 8.1.6, where? 50 Open 06/10/2001
 Palm Pilot CDK, Java Edition Problem. 50 Open 07/19/2001
 Oracle JDBC problem 50 Open 07/20/2001
 Java Puzzling Question in Java 100 Open 08/13/2001
 Java Comment of JBuilder and VisualAge 50 Open 08/15/2001
 PHP Installation of PHP on Unix System and work with iPlanet 50 Open 12/17/2000
 Java delete function in File Class problem. 100 Open 08/24/2001
 Java File.delete() functions problem. 100 Open 08/24/2001
 Solaris rcp(remote copy) problem. 50 Open 09/19/2001
 Unix Prog. Strange problem in the shared memory access. 50 Open 11/06/2001
 Web Tools JBoss iPlanet/Apache 50 Open 01/03/2002
 Java ABout Runtime class problem 50 Open 01/15/2002

Thanks all,
Moondancer
Community Support Moderator @ Experts Exchange
SECOND REQUEST - ADMINISTRATION WILL BE CONTACTING YOU SHORTLY.

Question(s) below appears to have been abandoned. Your options are:
 
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you. You must tell the participants why you wish to do this, and allow for Expert response.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question. Again, please comment to advise the other participants why you wish to do this.

For special handling needs, please post a zero point question in the link below and include the question QID/link(s) that it regards.
https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click the Help Desk link on the left for Member Guidelines, Member Agreement and the Question/Answer process.  https://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

Please click you Member Profile to view your question history and keep them all current with updates as the collaboration effort continues, to track all your open and locked questions at this site.  If you are an EE Pro user, use the Power Search option to find them.

To view your open questions, please click the following link(s) and keep them all current with updates.
https://www.experts-exchange.com/questions/Q.20076210.html
https://www.experts-exchange.com/questions/Q.20088967.html
https://www.experts-exchange.com/questions/Q.20093175.html
https://www.experts-exchange.com/questions/Q.20097921.html
https://www.experts-exchange.com/questions/Q.20103210.html
https://www.experts-exchange.com/questions/Q.20104138.html
https://www.experts-exchange.com/questions/Q.20109648.html
https://www.experts-exchange.com/questions/Q.20109688.html
https://www.experts-exchange.com/questions/Q.20113210.html
https://www.experts-exchange.com/questions/Q.20088493.html
https://www.experts-exchange.com/questions/Q.11225578.html
https://www.experts-exchange.com/questions/Q.20131175.html
https://www.experts-exchange.com/questions/Q.20154416.html
https://www.experts-exchange.com/questions/Q.20167468.html
https://www.experts-exchange.com/questions/Q.20173389.html
https://www.experts-exchange.com/questions/Q.20173655.html
https://www.experts-exchange.com/questions/Q.20184747.html
https://www.experts-exchange.com/questions/Q.20227572.html
https://www.experts-exchange.com/questions/Q.20255361.html
https://www.experts-exchange.com/questions/Q.20026626.html
https://www.experts-exchange.com/questions/Q.20098610.html
https://www.experts-exchange.com/questions/Q.20127814.html
https://www.experts-exchange.com/questions/Q.20132764.html
https://www.experts-exchange.com/questions/Q.20153462.html
https://www.experts-exchange.com/questions/Q.20168978.html
https://www.experts-exchange.com/questions/Q.20250983.html


To view your locked questions, please click the following link(s) and evaluate the proposed answer.
https://www.experts-exchange.com/questions/Q.20026625.html
https://www.experts-exchange.com/questions/Q.20067952.html
https://www.experts-exchange.com/questions/Q.20101120.html
https://www.experts-exchange.com/questions/Q.20104135.html
https://www.experts-exchange.com/questions/Q.20114116.html
https://www.experts-exchange.com/questions/Q.20064604.html
https://www.experts-exchange.com/questions/Q.11410998.html

PLEASE DO NOT AWARD THE POINTS TO ME.  
 
------------>  EXPERTS:  Please leave any comments regarding your closing recommendations if this item remains inactive another seven (7) days.
 
Thank you everyone.
 
Moondancer
Moderator @ Experts Exchange

P.S.  For any year 2000 questions, special attention is needed to ensure the first correct response is awarded, since they are not in the comment date order, but rather in Member ID order.
Admin notified of User neglect. Force-accepted by
Netminder
CS Moderator