Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Can't connect to oracle db from web/servlet server

Re: Can't connect to oracle db from web/servlet server

From: Uwe Schneider <uwe_at_richard-schneider.de>
Date: Fri, 15 Mar 2002 23:30:59 +0100
Message-ID: <3C927623.FEF359CD@richard-schneider.de>


Tim Bezek wrote:
>
> ideas please!
>
> I have oracle 8i ver 8.1.7 running on linux redhat7.2 I'm trying to connect
> to
> it using JDBC from another linux server running a servlet engine. I get an
> exception that "the network adapter could not establish the connection"
>
> I have the listener running on the database server, and I can connect to it
> with an oracle client on a windows 2000 box. Do I need to add something
> else to the servlet server? The only thing I added was the classes12.zip,
> which is supposed to be the "thin" jdbc classes that should work. I'm
> attempting to connect on port 1521, which is active and listening on the
> oracle
> server. I'm using TCP. From what I can tell the tnsnames.ora looks ok.
>
> What am I missing?
>

For JDBC thin drivers you specify the hostname, port, and Oracle SID in the connect string.

Connection conn = DriverManager.getConnection

                  ("jdbc:oracle:thin:@myhost:1521:orcl", "scott",
"tiger");

Make sure that:

- The client can resolve the servers host name
- The client can ping the server
- The client can connect to TCP port 1521 on the server
- The listener can find the instance 

For the last question consult $ORACLE_HOME/network/log/listener.log on the server.

Uwe

-- 
Uwe Schneider       | Telefon +49 7244 / 609504
Haydnstr. 1         | Mail    uwe_at_richard-schneider.de
DE-76356 Weingarten | http://www.richard-schneider.de/uwe
Linux - OS al dente!
Received on Fri Mar 15 2002 - 16:30:59 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US