Solved

unix & oracle

Posted on 2002-06-19
9
347 Views
Last Modified: 2010-03-31
hi all,
I need to nkow what is the most simply
way to know (from a java program),
if oracle server is installed on the machine (unix machine).
thanks Eran
0
Comment
Question by:raichel
9 Comments
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 20 total points
Comment Utility
A quick and dirty way would be to do the following:
1. Find out the name of the executable on the box it's installed on ('oracle' ?)
2. Execute a shell command from java e.g. find -name <name of executable>
0
 
LVL 1

Expert Comment

by:howesd
Comment Utility
The find approach might be a bit iffy - it can only search in directories which you've got permission to look in. If the executeable is in a directory you can look in, find won't find it.

Unfortunately, I haven't got any better ideas .......
0
 

Author Comment

by:raichel
Comment Utility
come on!
u can do better!!!
:-)
0
 
LVL 9

Expert Comment

by:Venci75
Comment Utility
you can check wheher there is a process listening on port 1521. but this won't work in all cases
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 4

Expert Comment

by:jos010697
Comment Utility
You could try and load the oracle supplied JDBC driver; if it throws an exception, most likely ClassDefNotFound, the database probably isn't there ...

kind regards
0
 
LVL 1

Accepted Solution

by:
MaxMaxic earned 30 total points
Comment Utility
Hi.
STEP 1.
You can check if there is a file /etc/oratab.
The last line of that file contains the following line:
*:/usr/local/public/OraHome1:N
the ':' is a separator, so you can extract the second field -- /usr/local/public/OraHome1 -- this is an installation directory of Oracle.
STEP 2.
Now to be sure that this is an Oracle server installation, you should do as following:
check if there is a directory /usr/local/public/OraHome1/dbs exists.
It it doesn't and "STEP 1" was "true" it is an installtion of ORACLE client.
I checked this on RedHat 7.2 and Oracle 8.1.5.

I hope it helps.


0
 
LVL 1

Expert Comment

by:chdba
Comment Utility
Hi

A long time ago I worked with Oracle on Unix.

To MaxMaxic's suggestion:
in oratab can be several "last"-lines (for every instance one line):
Dxyz:/usr/local/public/OraHome1:N
Txyz:/usr/local/public/OraHome1:N
Pxyz:/usr/local/public/OraHome1:Y
Exyz:/usr/local/public/OraHome1:N

The first field tells you the Instance-Name (* = all),
The second field tells you the home-directory of oracle
The third field tells you if the database-instance will be startet up at unix-startup (N=no, Y=yes).
So if you'll find there a "Y" then this will definitive be an oracle server installation. Otherwise you can still look for the directory MaxMaxic mentioned. - But on my client installations there was usually also a directory .../OraHome1/dbs.

The default value of the third field is "N". So if the database administrator did not modify this file, it gets a little bit triggy to figure out "server installation or not".

A running oracle you can find with "ps -ef | grep oracle"

I hope this helps also
chdba
0
 
LVL 35

Expert Comment

by:girionis
Comment Utility
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this
question is:

- split points between CEHJ and MaxMaxic

Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

girionis
Cleanup Volunteer
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now