Hello,
My requirement is based on Oracle where we run a perl script and it asked some questions.I want to write a wrapper which will answer all these questions.
How is it possible.
Thanks
Hello,
My requirement is based on Oracle where we run a perl script and it asked some questions.I want to write a wrapper which will answer all these questions.
How is it possible.
Thanks
You could try something like this:
#!/bin/sh
/path/to/oracle/script.pl <<"EOF"
answer1
answer2
answer3
EOF
This I have already tried and it does not work..
In what manner does it "not work". Be specific.
In fact, why not post the perl script?
Basically the answers are passed in the successive manner in 1 go..and the paramter keep telling null has been received...
Please post the perl script so we can see what form of input it needs. If it's simply reading from stdin, that ought to work.
#!/bin/sh
/mnt/oracle/oracle/product/11.2.0/dbhome_2/appsutil/bin/adbldxml.pl <<EOF
apps
aa
rr
qq
EOF
[oracle@wkdevpr12rac1 bin]$
OUTPUT
Starting context file generation for db tier..
Using JVM from /mnt/oracle/oracle/product/11.2.0/dbhome_2/appsutil/jre/bin/java to execute java programs..
/mnt/oracle/oracle/product/11.2.0/dbhome_2/appsutil/jre/bin/java -classpath /mnt/oracle/oracle/product/11.2.0/dbhome_2/jdbc/lib/ojdbc5.jar:/mnt/oracle/oracle/product/11.2.0/dbhome_2/appsutil/java:/mnt/oracle/oracle/product/11.2.0/dbhome_2/appsutil/java/xmlparserv2.jar:/mnt/oracle/oracle/product/11.2.0/dbhome_2/jlib/netcfg.jar:/mnt/oracle/oracle/product/11.2.0/dbhome_2/jlib/ldapjclnt11.jar
-user apps
APPS Password:
The log file for this adbldxml session is located at:
/mnt/oracle/oracle/product/11.2.0/dbhome_2/appsutil/log/adbldxml_10031722.log
AC-20010: Error: File - listener.ora could not be found at the location:
/listener.ora
indicated by TNS_ADMIN. Context file can not be generated.
Could not Connect to the Database with the above parameters, Please answer the Questions below
Enter Hostname of Database server:
Enter Valid Input
Enter Hostname of Database server:
Enter Valid Input
Enter Hostname of Database server:
Enter Valid Input
It should have passed aa
APPS Password:
I bet this is being read from /dev/tty, not not stdin.
As for the rest, I still cannot say, because you still haven't posted the perl script, please post the perl script.
okay..attached is the same...
Attachment...
Thanks. The script accepts arguments like /mnt/oracle/oracle/product/11.2.0/dbhome_2/appsutil/bin/adbldxml.pl appsuser=username appspass=pass template=templatename logfile=filename outfile=outfilename servername=server jtop=stuff
If you want it to ask, you can do a shell script like
#!/bin/sh
printf "username: "
read DBUSER
...
/mnt/oracle/oracle/product/11.2.0/dbhome_2/appsutil/bin/adbldxml.pl appsuser="$DBUSER"
no this wont work..because the parameters are not in the perl script..if you see the main program..it calls the java..where alll this is defined...
---------- Post updated at 08:34 AM ---------- Previous update was at 08:33 AM ----------
Do we have any other way...I am yet to find a workable solution..
Thanks
Where does the Perl program ask for the input as seen above?
tyler_durden
When we call the perl script it will call a java program and there it will ask you 3 questions...
Enter HostName
Enter Port
Enter SID
I need to provide the same using a wrapper perl script..or any other way it can be done...
It definitely feeds those options into java:
my $optionString = getOptions();
my $err = runSystemCmd("$javaCmd "."oracle.apps.ad.context.GenerateContext ". "$optionString");
Try adding the line
print STDERR $optionString, "\n";
above runSystemCmd so you can see what it's actually feeding into java. That will help you get it 'just right'.
I have all the tried and nothing works..i need to read the screen ouptut and then input based on the same...
Thanks
What does that Java program look like?
tyler_durden