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:@", "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
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.
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.

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,
embertAuthor Commented:
thanks all. you are all very helpful, however, I only can accept one answer
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.