Results 1 to 14 of 14
  1. #1
    Join Date
    Feb 2004
    Posts
    8

    Question Unanswered: Can't connect to Oracle from remote machine

    hi,

    i'm a newbie. i just installed oracle 10g on a Redhat AS 3 box. everything seems to be well and running.
    but when i try to connect the oracle server from another computer using JDBC thin driver i found that i couldn't connect to it.

    i nmap the oracle server from my working server and found the port 1521 was closed. but at oracle i nmap localhost, the port 1521 was open. i didn't configurate any firewall rules ... strange.

    Please help me. Thank you very much.

  2. #2
    Join Date
    Jan 2004
    Posts
    370
    Cannot connect to the server...

    Open and closed ports are very good and well, but they tell us nothing about your problem.

  3. #3
    Join Date
    Feb 2004
    Posts
    8
    if 1521 is closed can i connect to db?

    i can run sqlplus and EM well on oracle server but i can't even connect to 1521 from my developing workstation

  4. #4
    Join Date
    Jan 2004
    Posts
    370
    Forget about port 1521 - it is the default port, but that doesn't mean your listener is configured to use it.

    Is the listener running on the server?

    What errors are you getting when you try to connect?

  5. #5
    Join Date
    Feb 2004
    Posts
    8
    no errors when i ran sqlplus on oracle server. i was able to login and execute sqls

    now i want to write a java class to connect to the db. so i use oracle.jdbc driver and i need to know the port to connect.

    if not 1521 what should it be?

  6. #6
    Join Date
    Jan 2004
    Posts
    370
    It will be whatever port your listener is configured to listen on.
    The default is 1521.

    Is your listener running on the server?

  7. #7
    Join Date
    Feb 2004
    Posts
    8
    i think so.

    LSNRCTL> service
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)) )
    Services Summary...
    Service "PLSExtProc" has 1 instance(s).
    Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
    Handler(s):
    "DEDICATED" established:0 refused:0
    LOCAL SERVER
    Service "orcl" has 1 instance(s).
    Instance "orcl", status READY, has 1 handler(s) for this service...
    Handler(s):
    "DEDICATED" established:1 refused:0 state:ready
    LOCAL SERVER
    Service "orclXDB" has 1 instance(s).
    Instance "orcl", status READY, has 1 handler(s) for this service...
    Handler(s):
    "D000" established:0 refused:0 current:0 max:1022 state:ready
    DISPATCHER <machine: ozark, pid: 7184>
    (ADDRESS=(PROTOCOL=tcp)(HOST=ozark)(PORT=33276))
    The command completed successfully

  8. #8
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    Is the Oracle listener actually up & ready?

    from the command line on the DB server system do

    lsnrctl status

    What is displayed/returned?

  9. #9
    Join Date
    Feb 2004
    Posts
    8
    [oracle@ozark bin]$ nmap localhost

    Starting nmap V. 3.00 ( www.insecure.org/nmap/ )
    Interesting ports on ozark (127.0.0.1):
    (The 1590 ports scanned but not shown below are in state: closed)
    Port State Service
    22/tcp open ssh
    25/tcp open smtp
    111/tcp open sunrpc
    631/tcp open ipp
    1521/tcp open oracle
    5520/tcp open sdlog
    6000/tcp open X11
    8080/tcp open http-proxy
    10000/tcp open snet-sensor-mgmt
    32770/tcp open sometimes-rpc3
    32771/tcp open sometimes-rpc5

    Nmap run completed -- 1 IP address (1 host up) scanned in 1 second



    but i still can not telnet oracle 1521 at my workstation

  10. #10
    Join Date
    Feb 2004
    Posts
    8
    [oracle@ozark bin]$ ./lsnrctl status

    LSNRCTL for Linux: Version 10.1.0.2.0 - Production on 27-FEB-2004 09:31:32

    Copyright (c) 1991, 2004, Oracle. All rights reserved.

    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)) )
    STATUS of the LISTENER
    ------------------------
    Alias LISTENER
    Version TNSLSNR for Linux: Version 10.1.0.2.0 - Production
    Start Date 27-FEB-2004 09:21:57
    Uptime 0 days 0 hr. 9 min. 35 sec
    Trace Level off
    Security ON: Local OS Authentication
    SNMP OFF
    Listener Parameter File /home/oracle/product/10.1.0/db_1/network/admin/listener.ora
    Listener Log File /home/oracle/product/10.1.0/db_1/network/log/listener.log
    Listening Endpoints Summary...
    (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)) )
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0. 1)(PORT=1521)))
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0. 1)(PORT=8080))(Presentation=HTTP)(Session=RAW))
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0. 1)(PORT=2100))(Presentation=FTP)(Session=RAW))
    Services Summary...
    Service "PLSExtProc" has 1 instance(s).
    Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
    Service "orcl" has 1 instance(s).
    Instance "orcl", status READY, has 1 handler(s) for this service...
    Service "orclXDB" has 1 instance(s).
    Instance "orcl", status READY, has 1 handler(s) for this service...
    The command completed successfully

  11. #11
    Join Date
    Feb 2004
    Posts
    8
    my java class is:
    import java.sql.*;
    import oracle.jdbc.*;

    public class JDBCVersion {
    public JDBCVersion() {

    }

    public static void main (String args[])
    throws SQLException
    {
    // Load the Oracle JDBC driver
    DriverManager.registerDriver
    (new oracle.jdbc.driver.OracleDriver());
    Connection conn = DriverManager.getConnection
    ("jdbcracle:thin:@10.10.101.220:1521rcl","callcenter","q1w2e3");

    // Create Oracle DatabaseMetaData object
    DatabaseMetaData meta = conn.getMetaData();

    // gets driver info:
    System.out.println("JDBC driver version is " + meta.getDriverVersion());
    }

    }


    when i ran it on my workstation or laptop i got exceptions:
    java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBE rror.java:134)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBE rror.java:179)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBE rror.java:334)
    at oracle.jdbc.driver.OracleConnection.<init>(OracleC onnection.java:418)
    at oracle.jdbc.driver.OracleDriver.getConnectionInsta nce(OracleDriver.java:521)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriv er.java:325)
    at java.sql.DriverManager.getConnection(DriverManager .java:512)
    at java.sql.DriverManager.getConnection(DriverManager .java:171)
    at JDBCVersion.main(JDBCVersion.java:15)
    Exception in thread "main"

  12. #12
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    It might depend upon the contents of sqlnet.ora

    In some cases it expects the "host alias" to be like
    PROD.WORLD
    or
    PROD.MACHINE.DOMAIN.COM

  13. #13
    Join Date
    Jan 2004
    Posts
    370
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0. 1)(PORT=1521)))

    Can you change 127.0.0.1 to the hostname or ip address in listener.ora?

  14. #14
    Join Date
    Feb 2004
    Posts
    8

    Thumbs up

    Originally posted by SkyWriter
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0. 1)(PORT=1521)))

    Can you change 127.0.0.1 to the hostname or ip address in listener.ora?
    it works. Thanks a lot

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •