Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    25

    Red face Unanswered: ct_results : Connection marked dead

    Hi,

    I try to access a Sybase server by a perl script and by using the Open Client Library.

    When I send the command "use master" (for instance", I receive the following error :

    Open Client Message: (In msg_cb)
    Message number: LAYER = (1) ORIGIN = (1) SEVERITY = (1) NUMBER = (50)
    Message String: ct_results(): user api layer: external error: The connection has been marked dead.

    My perl code is the following :

    use Sybase::CTlib;

    $X = new Sybase::CTlib $uid, $pwd, $srv, "Test" || die "Can't connect to the server $srv !!";


    print "Composition of the string of connection !!!\n";
    $cuse="use $db";
    print "String = $cuse\n\n";
    print "Execution of the use database\n\n";

    if ($X->ct_sql($cuse)) {
    print "Connection succeeded\n";
    }
    else {
    print "Connection problem\n";
    }

    if (($rc=$X->ct_results($restype)) != CS_SUCCEED) {
    print "Error during the use database $cuse !!\n";
    exit;
    }

    Remark: I receive the message that the connection is succeeded !!

    Can someone help me ?

  2. #2
    Join Date
    Jan 2003
    Location
    Geneva, Switzerland
    Posts
    353

    Re: ct_results : Connection marked dead

    Originally posted by xavier_urbain

    I try to access a Sybase server by a perl script and by using the Open Client Library.

    When I send the command "use master" (for instance", I receive the following error :

    Open Client Message: (In msg_cb)
    Message number: LAYER = (1) ORIGIN = (1) SEVERITY = (1) NUMBER = (50)
    Message String: ct_results(): user api layer: external error: The connection has been marked dead.

    My perl code is the following :

    use Sybase::CTlib;

    $X = new Sybase::CTlib $uid, $pwd, $srv, "Test" || die "Can't connect to the server $srv !!";


    print "Composition of the string of connection !!!\n";
    $cuse="use $db";
    print "String = $cuse\n\n";
    print "Execution of the use database\n\n";

    if ($X->ct_sql($cuse)) {
    print "Connection succeeded\n";
    }
    else {
    print "Connection problem\n";
    }

    if (($rc=$X->ct_results($restype)) != CS_SUCCEED) {
    print "Error during the use database $cuse !!\n";
    exit;
    }
    You are calling ct_results() at the wrong time as ct_sql() already calls ct_results() for you.

    You call ct_results() *after* having initialized a new command with ct_execute(), like this:

    $dbh->ct_execute("select * from master..sysprocesses");
    while($dbh->ct_results($restype) == CS_SUCCEED) {
    next unless $dbh->ct_fetchable($restype);
    while(@data = $dbh->ct_fetch) {
    print "@data\n";
    }
    }

    If you look at the perl code for ct_sql (in the CTlib.pm file) you'll see that it performs this loop for you.

    Michael

  3. #3
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    25

    Re: ct_results : Connection marked dead

    Michael,

    I remove the ct_results but the problem is still there. I can not send the command use <database> to the Sybase server.

    Any idea ?

    Xavier

  4. #4
    Join Date
    Jan 2003
    Location
    Geneva, Switzerland
    Posts
    353

    Re: ct_results : Connection marked dead

    Originally posted by xavier_urbain
    Michael,

    I remove the ct_results but the problem is still there. I can not send the command use <database> to the Sybase server.

    Any idea ?

    Xavier
    Do you mean that:

    $dbh->ct_sql("use master");

    on its own fails with "connection marked dead"?

    If so, you need to check the ASE server error log, because I suspect a problem at the server level.

    Michael

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •