Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Hi folks!

I have the following problem:

I want to write a simple script that compares the contents of two tables for my Sybase DBA Perl Cookbook.

The script iterates over all rows from one table, select the corresponding row from the other table and print the primary keys if the rows are different.
So nothing much.

But if I try to execute a statement with placeholders while another statement has results pending, the Sybase Client Library pukes:

ct_param() failed! at /tmp/xx.pl line 33. DBD::Sybase::st execute failed: OpenClient message: LAYER = (1) ORIGIN + = (1) SEVERITY = (1) NUMBER = (16) Message String: ct_param(): user api layer: external error: This routine cannot be called while results are pending for a comm +and that has been sent to the server. DBD::Sybase::st execute failed: OpenClient message: LAYER = (1) ORIGIN + = (1) SEVERITY = (1) NUMBER = (16) Message String: ct_param(): user api layer: external error: This routine cannot be called while results are pending for a comm +and that has been sent to the server.
The script:
#!/usr/bin/perl use strict; use warnings; use DBI; my $dbh1 = DBI->connect("dbi:Sybase:server=server1;database=database1" +, 'user1', 'passwd1'); my $dbh2 = DBI->connect("dbi:Sybase:server=server2;database=database2" +, 'user2', 'passwd2'); my $sth1 = $dbh1->prepare("select * from table1"); my $sth2 = $dbh2->prepare("select * from table2 where primkey = ?"); $sth1->execute; #---- iterate through table1, check in table2 while (my @row1 = $sth1->fetchrow_array) { $sth2->execute($row1[0]); # this is li +ne 33 my @row2 = $sth2->fetchrow_array; }

Versions:

Perl:        5.8.0 Linux
DBI:         1.30
DBD::Sybase: 0.95

Perl:        5.6.1 NT
DBI:         1.30
DBD::Sybase: 0.91
Anyone came across this before?

Is this a serious limitation in the Sybase Client Library?

The workaround would be to use a selectrow in each iteration, which would be dead slow.

Would a bind_param help?


In reply to two connections to the same database with DBD::Sybase by busunsl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • 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.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-04-23 16:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found