From perl program query is not executed.

You provided two values for sid, is the second one correct?

my $sid = "dbd";

Please just post the exact text from your terminal including the commands executed.

my $sid = "dbd";

is correct. When manually connected through sqlplus it works.

Through perl, this particular db connected and prints the sysdate.

 perl testDB.pl
04-MAR-15

.
But it does not print the other query.

---------- Post updated at 09:55 AM ---------- Previous update was at 09:26 AM ----------

some solutions will help us.

Hi,
Why do you not use the tnsname ?

my $dbh = DBI->connect("dbi:Oracle:$sid",$user,$passwd)

Regards.

the database is connected while executing perl. while executing the query its gets below error.

main::(testDB.pl:14):   my $dbh = DBI->connect("dbi:Oracle:host=$host;sid=$sid;port=1588",$user,$passwd) or die "Couldn't able to connect to database $@\n";
  DB<1> n
main::(testDB.pl:22):   my $sql ="select tname from tab where tname='CQC_TEST_CASES'";
  DB<1> n
main::(testDB.pl:23):   my $sth = $dbh->prepare($sql);
  DB<1> n
main::(testDB.pl:24):   $sth->execute();
  DB<1> n
DBD::Oracle::st execute failed: ORA-03106: fatal two-task communication protocol error (DBD ERROR: OCIStmtExecute) [for Statement "select tname from tab where tname='CQC_TEST_CASES'"] at testDB.pl line 24.

---------- Post updated at 12:39 AM ---------- Previous update was at 12:36 AM ----------

for the below query its works.

main::(testDB.pl:14):   my $dbh = DBI->connect("dbi:Oracle:host=$host;sid=$sid;port=1588",$user,$passwd) or die "Couldn't able to connect to database $@\n";
  DB<1> n
nmain::(testDB.pl:20):  my $sql ="select sysdate from dual";
  DB<1>
nmain::(testDB.pl:23):  my $sth = $dbh->prepare($sql);
  DB<1> n
  DB<2> n
main::(testDB.pl:24):   $sth->execute();
  DB<2> n
main::(testDB.pl:25):   while (my $row = $sth->fetchrow_array)
main::(testDB.pl:26):   {
  DB<2> n
main::(testDB.pl:27):     print $row . "\n";
  DB<2> n
04-MAR-15

---------- Post updated at 01:27 AM ---------- Previous update was at 12:39 AM ----------

does it is getting failed. since sysdate returning one value. do I need to change any syntax in the code.

---------- Post updated at 01:43 AM ---------- Previous update was at 01:27 AM ----------

Do we need to set NLS_LANG in the unix commands prompt. Currently I could it it empty.

echo $NLS_LANG
 

---------- Post updated at 04:37 AM ---------- Previous update was at 01:43 AM ----------

any inputs above the issue.

---------- Post updated at 04:58 AM ---------- Previous update was at 04:37 AM ----------

Thanks all for your inputs.

The issue is fixed by changing oracle version to 9.2.0

---------- Post updated at 07:00 AM ---------- Previous update was at 04:58 AM ----------

since it was oracle 9i client.