Jeff;

I will try your suggestion. Thanks for the quick response.

Ron
-----Original Message-----
From: Jeff Urlwin [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 12, 2005 11:05 AM
To: [EMAIL PROTECTED]; [email protected]
Subject: RE: Accessing MS SQL Server data using PERL and DBI


> Help!
> 
> I have a SQL SERVER database hosted on an NT server.
> I am trying to connect to the database using PERL from LINUX.
> I am currently using DBD::ODBC but the multiple query 
> restriction is causing problems because I need to do lookups. 

If it's just simple lookups (which it may not be ;), you can try the extra
connection
method.  i.e. have a $dbh2 connected to the same database and have a lookup
function which
uses $dbh2, not your main $dbh.  Then you could write a lookup function
which does
something like (I'm entering the code on the fly here, so this may not work
out of the
box, but the concept should/could work!!!):

# returns an array ref.
sub single_row_lup($$) {
   my $query = shift;
   my $params = shift;  # ref to array.  See perldoc perlref for help, my
syntax here may
not be correct for all.

   my $sth = $dbh2->prepare_cached($query); 
   $sth->execute($params);
   my $ret = $sth->fetchrow_arrayref();
   $sth->finish;
   $ret;
}

Lots of possible variations on this using: selectall_xxxx family and
selectrow_xxx family.
Which of course brings up the natural question about selectall_xxx and
selectrow_xxx,
should they have a "cached" variation?  Am I missing something?

Jeff
   
> I have tried the ODBC_CURSORTYPE on connect but the extra 
> query when tested was very slooooow when set in the loop 
> retrieving the primary data. I then tried to use DBD::SYBASE 
> with a stored procedure with one required parameter and even 
> though I used a bind_param to convert that parameter, the SQL 
> error stated that I could not implicitly convert a VARCHAR to 
> INT. I have read only access to the SQL SERVER database.
> 
> Everywhere I turn I run into placeholder restrictions or 
> query cursor restrictions or everything runs with no errors 
> but nothing is returned.
> 
> My preference is getting the multiple queries working either 
> with ODBC or SYBASE using placeholders.
> 
> Any ideas?
> 
> Versions in use:
> 
> PERL is 5.8.0
> other modules.....
> 
> Net::SSLeay|Net::SSLeay VERSION: 1.23
> RRDs|RRDs VERSION: 1.000481
> Convert::ASN1|Convert::ASN1 VERSION: 0.18 
> Convert::ASN1|Convert::ASN1 VERSION: 0.18 
> Authen::SASL|Authen::SASL VERSION: 2.08 
> IO::Socket::SSL|IO::Socket::SSL VERSION: 0.96 
> XML::NamespaceSupport|XML::NamespaceSupport VERSION: 1.08 
> XML::SAX|XML::SAX VERSION: 0.12
> perl-ldap|perl-ldap VERSION: 0.31
> Unicode::MapUTF8|Unicode::MapUTF8 VERSION: 1.09
> String|String VERSION: 1.5
> Unicode::MapUTF8|Unicode::MapUTF8 VERSION: 1.09 
> Unicode::String|Unicode::String VERSION: 2.07
> Jcode|Jcode VERSION: 0.83
> Unicode::Map|Unicode::Map VERSION: 0.112 
> Unicode::Map8|Unicode::Map8 VERSION: 0.12 
> Unicode::MapUTF8|Unicode::MapUTF8 VERSION: 1.09
> DBI|DBI VERSION: 1.42
> DBD::ODBC|DBD::ODBC VERSION: 1.09
> DBD::Oracle|DBD::Oracle VERSION: 1.15
> DBD::Sybase|DBD::Sybase VERSION: 1.04_9
> 
> 
> Freetds is 0.621......Sybase ASE libraries are 12_52
> 
> 
> 
>       Ron Pothier
>       Programmer/Analyst
>       CANMARNET Support
>       *Phone:  902 427-0550 ext 6450 (CSN) 447-6450
>       *Fax: 902 427-6626 (FAX)
>       *Internet E-Mail: [EMAIL PROTECTED]
>       * PO Box 99000 Station Forces, Halifax NS, B3K 5X5
>       http://halifax.mil.ca/N6
> 

Reply via email to