1752579 Members
2939 Online
108788 Solutions
New Discussion юеВ

Re: Need Help

 
System Dude_1
Frequent Advisor

Need Help

Dear friend,

I'm new to the scripting and would like to get advice from all dear friend on how to develop a scriptas follow :

I have two server. Server A has Oracle database and server B has Informix database. I have an application residing on server B that need to do query to server A on the Oracle database. Unfortunately, I do not have ODBC driver for both database. The only thing that I can think of is using a c shell script that need to pass a parameter in server B, then connect to a store procedure in server A. Then the store procedure pass back the result to the c script and then the script write to Informix database. But I could have a clue on how to write this. Please Help.
Performance Issue on HP-UX 10.20
9 REPLIES 9
Jeff Machols
Esteemed Contributor

Re: Need Help

On server A, create a .sql file with your SQL qeury. Then from server B, you could run

remsh serverA "${ORAHOME}/bin/isql login@password query.sql"

the other thing to do, can you start an Oracle listener on server B, then you could run the query localy instead of using remsh
Justo Exposito
Esteemed Contributor

Re: Need Help

Hi,

You can use remsh in order to run the script form the server B in the server A. If you redirect the output to a file this file resides in the B server.

You can try to start with a simple script in order to learn how remsh works like this:
remsh hostA -n cat file > /tmp/fileout

You can see that the output will be in the /tmp directory of the server B.

Hope this help you.

Regards.
Help is a Beatiful word
System Dude_1
Frequent Advisor

Re: Need Help

OK. I've got the file in the server B. but the problem is how to pass in the value or to let the application know that the file exist. Example. If file exist in server B then I will write the value to Informix database. If not then do nothing.

Performance Issue on HP-UX 10.20
Justo Exposito
Esteemed Contributor

Re: Need Help

Hi,

You probably from your application can run by a call system statment the script that do the remsh, then you can use a procedure into informix to do an insert into a table and then you can check this table in order to know if you must do something.

Regards,

Justo.
Help is a Beatiful word
Jeff Machols
Esteemed Contributor

Re: Need Help

if [ -f file ] # file exists
then
do command
fi

System Dude_1
Frequent Advisor

Re: Need Help

Ok, let says that I need a c script for this. How should I do it as I'm not well verse in c script.

My shell script as follows and I need a c script:

1. I need to pass in a employee name to get his/her salary. How to pass it in?

sqlplus -s user/Password@oracle @script.sql $1
tail -2 $1.lst > $1.tmp
mv $1.tmp $1.lst

2. In the same script I need to return the value. If file exist then I need to return a 1 value and if file did not exist then I return 0 value.

Performance Issue on HP-UX 10.20
System Dude_1
Frequent Advisor

Re: Need Help

Please help me
Performance Issue on HP-UX 10.20
System Dude_1
Frequent Advisor

Re: Need Help

Help me anybody
Performance Issue on HP-UX 10.20
Justo Exposito
Esteemed Contributor

Re: Need Help

Hi,

Something like this:
sqlplus -s user/Password@oracle @script.sql $1
tail -2 $1.lst > $1.tmp
mv $1.tmp $1.lst

if [ -f $1.lst ] # file exists
then
return 1
else
return 0
fi

Happy new year!!
Justo.
Help is a Beatiful word