Hi all,

I like to moitor the database server from application server.I like to check tha particular server fo this DataBaseis up and runnig. I could do it in Java( JDBC program). But the difficulty is when i am spreading this program across all servers, i need to modify the entries in the java program accoring to that servers.Each time i have to compile the java program to work. So i am looking for sheel scripting. Is it possible to monitor the DB from Shell scripting.

Please help me regarding this.

Jasmine

Why don't you write a properties file for your java program and just change
entries in that according to the server it is running on, rather than hard coding
the connect information into the java program (which, coincedentally, is bad
form anyway).

Hi

Yes. I agree that it is the bad coding(hard coding) . Properties file is the good idea which is free from compilation.

But can u please tell me is there any other option to achieve it using KSH scripting?

Thank you in advance.

Jasmine


Why don't you write a properties file for your java program and just change
entries in that according to the server it is running on, rather than hard coding
the connect information into the java program (which, coincedentally, is bad
form anyway).

Well, you can call the client program (sqlplus for oracle or mysql for mysql etc etc)
and redirect input with the commands you want and try to capture and evaluate the
output. Here an example from mysql with a simple select query:

mysql -uuser -ppassword -hhost <<EOF >filename
use mysql;
select * from user;
EOF

Then you have the output in "filename" and can do with it what you want.

Thank You very much for giving me an outline of what i can do.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.