Solved

unix & oracle

Posted on 2002-06-19
9
349 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
ID: 7092234
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
ID: 7092244
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
ID: 7092261
come on!
u can do better!!!
:-)
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 9

Expert Comment

by:Venci75
ID: 7092269
you can check wheher there is a process listening on port 1521. but this won't work in all cases
0
 
LVL 4

Expert Comment

by:jos010697
ID: 7092443
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
ID: 7093343
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
ID: 7093834
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
ID: 8860567
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
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:

776 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