how to find oracle server port?

I tried to use Oracle thin jdbc driver. the following segment is what I used:

Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:orcl", "scott", "tiger");

When I tried to run the program, it is said "Connection refused, no further information". Actually I dont really understand the 1521 and orcl. How do I find the oracle server port on my machine? what is oracle sid? what is orcl here?

thanks in advance
embertAsked:
Who is Participating?
 
mshaikhConnect With a Mentor Commented:
On the Oracle server the should be a file called listener.ora under $ORACLE_HOME/network/admin  or %ORACLE_HOME%\NET80\Admin. If you can find them here just search for it.

This file will tell you what Port number Oracle is listening for connections.

orcl is the SID this is the Instance's ID. This is name defined at database creation.
0
 
lieblaCommented:
orcl is the default SID forgiven by Oracle. If you have more than one database on a server each DB must have a unique SID.
Under Oracle 8 a SID can have a maximum length of 4 characters.
mshaikh comments is absolutely OK.
0
 
meowshCommented:
Mshaikh is correct.

The port is a hardware term (as opposed to Oracle / Operating System term) which roughly translates to a 'machine communication channel'.

The SID is the Oracle instance; an instance is an area of RAM on the machine normally dedicated to 'doing work' on one Oracle database.

ORCL is the default/example database that can be installed when you install Oracle.

Meowsh.
0
 
rhuggaCommented:
Also, make sure the scott user was created. I believe if you do not have orainst create the initial database for you, this user is not created.

From svrmgrl, issue 'select username from dba_users' and verify that this user exists. (Must be done as SYS or DBA user)

Also verify that the listener is in fact running. (Not started by default)

If this is unix, use 'netstat -a | grep LISTEN | more' and look for  something listening on the port defined in the listener.ora file mentioned above. (It is also easier to define the listener port in /etc/services and then grep for that specifically) Or you could always dig thru 'ps -ef' looking for the listener. (This will show the process, albeit not necessarily whether it is healthy or not) A third method you can use is '$ORACLE_HOME/bin/lsnrctl status'. If not running, use '$ORACLE_HOME/bin/lsnrctl start'.

good luck,
Chuck
0
 
embertAuthor Commented:
thanks all. you are all very helpful, however, I only can accept one answer
0
All Courses

From novice to tech pro — start learning today.