I have faced a major problem with DBI package when I am using perl5.8.4 in solaris 10 box.
use strict;
use DBI;
use Carp;
sub DB_xxx
{
my ($dbUser, $dbPass, $db, $autoCommit) = @_;
my $dbh;
# logon to DB
unless( $dbh = DBI->connect('dbi:Oracle:' . ($$db || ''), $$dbUser
+, $$dbPass,
{AutoCommit => $$autoCommit}) )
{
croak "Error connecting to database $DBI::errstr \n";
}
return $dbh;
}
my $user = "xxxx";
my $pass = "xxxx";
my $db ;
my $autocommit = 0;
my $dbh = DB_xxx(\$user, \$pass, \$db, \$autocommit);
#problem starts here
#if we so any unix command call or closing an file/pipe #handle after
+that such as using system() or backtricks it #returns -1 in $! & $? c
+onatins "no child process"
#example
`gzip -cd filename`;
# or system("gzip -cd filename");
#or open ($fh, "gzip -cd filename|");
#or close ($fh);
print "$?:$!\n";
after a dbi subroutine call any system call as example given above returning the message "no child process for $? & $! conatins "-1" as status.
But if we pass value for variable $db in code such as:
my $user = "xxx";
my $pass = "xxx";
my $db = "abcd";
#that is valid hostname for oracle.
the program is running wirhout throwing any warning or $! as 0.
I need to implement similar way by which sqlplus utility connect to database in local box only with user/password.
what I want through DBI is:
sqlplus xxx/xxx
what i don't want through DBI is
sqlplus xxx/xxx@abcd
Is it an existing bug in DBI? Is there any solution for this problem.
I have updated the text of message
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.