I have the following perl script working for me.I am accesing the database from my perl script using use Net::Telnet(); package.
I am not using DBI package.as I stated earlier the following program is printing the output in a nice form.However I want to pass
a variable in the
Expand|Select|Wrap|Line Numbers
- $t->cmd("SELECT * FROM TABLE_NAME WHERE INSTANCE_NAME LIKE '%hostname%' ;");
Expand|Select|Wrap|Line Numbers
- $t->cmd("SELECT * FROM TABLE_NAME WHERE INSTANCE_NAME LIKE '%VARIABLE_NAME%' ;");.
Thank You
Vivek
Expand|Select|Wrap|Line Numbers
- $IPAddress = " ";
- $Login = " ";
- $password = " ";
- $Node = "hostname";
- use Net::Telnet();
- $t= new Net::Telnet (Timeout => 3000 , Prompt => '/[%#\$>?:] $/' );
- $t->open("$IPAddress");
- print "\nConected!";
- $t->waitfor('/login: $/i');
- $t->print($Login);
- print "\nEntered the Username\n";
- $t->waitfor('/assword: $/i');
- $t->print($Password);
- print "\nEntered the Password!\n";
- @output=$t->cmd("export ORACLE_SID=$Node\n");
- print @output;
- print "\n Done with logging into the database\n";
- @output= $t->cmd("bash\n");
- print FILE @output;
- print @output;
- @output = $t->cmd("sqlplus username/pass\n");
- print @output;
- @output = $t->cmd("conn cusername/pass\n");
- print @output;
- @output = $t->cmd("SELECT * FROM TABLE_NAME WHERE INSTANCE_NAME LIKE '%hostname%' AND PARAM_KEY_NAME LIKE '%host';");
- print FILE @output;
- @output = $t->cmd("exit\n");
- print @output;
- @output = $t->cmd("exit\n");
- print @output;