Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: two connections to the same database with DBD::Sybase

by grinder (Bishop)
on Dec 10, 2002 at 15:55 UTC ( [id://218811]=note: print w/replies, xml ) Need Help??


in reply to two connections to the same database with DBD::Sybase

Ok, you have found the solution to your problem, so everything is fine. Just for the record, though, I have run into this problem before, and it's not Sybase-specific, I can do it on Sybase or Oracle!

I described my trials and tribulations at My script locks up using DBI.

The Sybase libraries for Perl, written by our own mpeppler are very well done. While the single statement per connection sounds like a limitation, in general it isn't. It turns out that you can do a very neat thing with Sybase that you can't do in most other databases: you can queue up a series of statements in a session handler and process them serially. This usually obviates the need of creating two sessions on a connection. You just stick them all in the one session, and iterate over them.

For instance (shamelessy stealing from the documentation), you can do legally do something like:

my $ss = $dbh->prepare(" insert foo(one, two, three) values(1, 2, 3) select * from bar insert foo(one, two, three) values(10, 11, 12) "); $ss->execute;

Ok, so you don't always need this, but when you do need it (speaking from experience), you need it bad.


print@_{sort keys %_},$/if%_=split//,'= & *a?b:e\f/h^h!j+n,o@o;r$s-t%t#u'

Replies are listed 'Best First'.
Re^2: two connections to the same database with DBD::Sybase
by Anonymous Monk on Jun 22, 2015 at 12:37 UTC
    The same script I have written to connect the sybase database, but giving the error" Script:
    #!/usr/bin/perl use Time::HiRes qw(sleep); use DBI; # Connect to the db my $dbh = DBI->connect( "dbi:Sybase:server=Server name; port=5000; database=PP_DB; interfa +ces=/opt/sybase/interfaces", "sa", "password" ) or die "Usage ctp name, sa user password, 1st Sub_id, Subscriber Ran +ge";
    Error:
    DBI connect('server=ctp-1-zone157; port=5000; database=PP_DB; interfac +es=/opt/sybase/interfaces','sa',...) failed: OpenClient message: LAYE +R = (6) ORIGIN = (8) SEVERITY = (5) NUMBER = (1) Server ctp-1-zone157, database Message String: ct_connect(): directory service layer: internal direct +ory control layer error: There was an error encountered while binding + to the directory service. at ./connectDB.pl line 6 Usage ctp name, sa user password, 1st Sub_id, Subscriber Range at ./co +nnectDB.pl line 6.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://218811]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-18 20:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found