Database handle to a child script using exec


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Database handle to a child script using exec
# 1  
Old 10-30-2009
Question Database handle to a child script using exec

Hello,

Can I pass a database handle created in parent script to a child script triggered using exec ??

Parent script
=========
$dbh =DBI->connect{......); # Db handle creation
$param1 =10; # parameter one
exec "childscript.pl $param1 $dbh "; # executing childscript.pl with two parameters $param and database handle

Is this possible ??

Please advice.

Coolbhai
coolbhai
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need exception handle for this script

Hi This is script to move log files from one location to other which is working fine. I need to add exception handling in this new to scripting. Please help #!/bin/ksh DB=QACCABOP dumppath='/udb/udbpa032/dump_data/offshore/Tran_logs' msg='/udb/udbpa032/utilities/DBAscripts/msg/msg.out'... (4 Replies)
Discussion started by: Mathew_paul
4 Replies

2. Shell Programming and Scripting

How to capture exit code of child script and send it to parent script?

#!/usr/local/bin/bash set -vx /prod/HotelierLinks/palaceLink/bin/PalacefilesWait /prod/HotelierLinks/palaceLink/bin/prodEnvSetup 03212013 & if then echo "fatal error: Palace/HardRock failed!!!!" 1>&2 echo "Palace Failed" | mail -s "Link Failed at Palace/HardRock" -c... (1 Reply)
Discussion started by: aroragaurav.84
1 Replies

3. Shell Programming and Scripting

Script Variables Inquiry, Values Okay in Standalone Exec, No-Show in Cron Exec

I have the following bash script lines in a file named test.sh. #!/bin/bash # # Write Date to cron.log # echo "Begin SSI Load $(date +%d%b%y_%T)" # # Get the latest rates file for processing. # d=$(ls -tr /rms/data/ssi | grep -v "processed" | tail -n 1) filename=$d export filename... (3 Replies)
Discussion started by: ginowms
3 Replies

4. Shell Programming and Scripting

Handle occasional condition in expect script

Hi, I am using Solaris OS, I want to handle an occasional expression in expect script while logging into a remote server with ssh. In normal scenario the expected expression is as below, spawn ssh $user@$ip expect "assword:" send "$password\r" but in a condition when the remote server... (2 Replies)
Discussion started by: varunksharma87
2 Replies

5. Homework & Coursework Questions

Need help with deleting childīs parent and child subprocess

1. The problem statement, all variables and given/known data: I need to make an program that in a loop creates one parent and five children with fork(). The problem i'm trying to solve is how to delete the parent and child of the childīs process. 2. Relevant commands, code, scripts,... (0 Replies)
Discussion started by: WhiteFace
0 Replies

6. Shell Programming and Scripting

help to handle the expect script issue

Hi experts I know the expect script can match the terminal output to run the the following cmd I write a script with expect named "test", I want to run ten "test" with background running, for ((i=1;i<=10;i++) do ./test -n $i done I find all the output of test will print on one... (0 Replies)
Discussion started by: yanglei_fage
0 Replies

7. Shell Programming and Scripting

i'm new to shell can handle this script for me plz

Write a shell script named displayargs that prints FOUR lines. The first line tells the name that was used to invoke the script, the second line tells how many parameters there were, the third line tells what the last parameter was, and the fourth line tells what the first parameter was. For... (8 Replies)
Discussion started by: kedah160
8 Replies

8. Shell Programming and Scripting

How to handle errors during script execution

Hi I have written a script which returns a number. This resulting number I assign to the variable for example: $ A=`get_dbnum 118 ttrn` $ echo ${A} 8208 $ The script becomes interective once the error occures and the number is not found. It prompts the user to enter the number. The... (1 Reply)
Discussion started by: aoussenko
1 Replies

9. Programming

Runtime.getSystem.exec() function waits for child

Runtime.getSystem.exec() waits for child process to complete .. I do not want to wait for the child process to complete ..what is the option which has to be used ? (2 Replies)
Discussion started by: shafi2all
2 Replies

10. Shell Programming and Scripting

How to handle the Multiple Rows in the Database

Hi All, I have problem with database validations, actually my requirement is, my code will generate some seqno;s, which i have to check in database, whether the generated seqno;s are present in database or not, if the generated seqno;s are present in the database means, i need to generate... (2 Replies)
Discussion started by: hsekol
2 Replies
Login or Register to Ask a Question
LedgerSMB::DBTest(3pm)					User Contributed Perl Documentation				    LedgerSMB::DBTest(3pm)

NAME
LedgerSMB::DBTest - LedgerSMB commit filter for test cases. SYOPSIS
This module creates a DBI-like interface but ensures autocommit is off, and filters commit statements such that they don't do anything. This can be used for making API test cases which involve DB commits safe for production environments. USAGE
Both LedgerSMB.pm and LedgerSMB/Form.pm assign a global database handler for all database access within a script in the dbh property (for example, $request->{dbh} or $form->{dbh}). By setting this early to a LedgerSMB::DBTest (instead of a DBI object), the tests can be made safe. However, there are a few limitations to be aware of. One cannot run tests through the standard request handler and use this module. Hence this is limited to unit tests of files in the LedgerSMB, scripts, and bin directories. Here is an example of how this could be done: my $lsmb = LedgerSMB->new(); $lsmb->merge($testdata); my $dbh = LedgerSMB::DBTest->connect("dbi:Pg:dbname=$company", "$username", "$password",) $lsmb->{dbh} = $dbh; METHODS
connect($dsn, $user, $pass) Connects to the database and returns a LedgerSMB::DBTest object commit() Tests the current transaction (issues a 'SELECT 1;' to the database). If this is successful returns 1, if not, rolls back and returns false. Note that this means all past tests are rolled back and this is inconsistent with normal transactional behavior. prepare() Returns a statement handle, via the private DBI database handle. do() passes this statement on to the private database handle errstr() passes this call on to the private database handle err() passes this call on to the private database handle quote() passes this call on to the private database handle quote_identifier() passes this call on to the private database handle rollback() passes this call on to the private database handle. Note that this will roll back all statements issues through this object. perl v5.14.2 2010-03-02 LedgerSMB::DBTest(3pm)