Charles,

It *should* work, but...I suspect your SQL*Server driver is ancient.  Mine is
2000.85.1117.00.  The 3.8.xxx version, I suspect, is from SQL7 days.  Please 
try updating
the machine's MDAC driver to at least 2.7 or greater and I think you will find 
different
behavior.

If that doesn't work, I would turn on DBI tracing to a low level (2,3 or 4 at 
first).  Run
a one-line sample and weed through the log to see what's going on.  If you need 
help with
that, post here.  I may ask you to post more.

Regards,

Jeff

> -----Original Message-----
> From: Charles Lawrence [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, March 08, 2005 3:25 PM
> To: [email protected]
> Subject: MSSQL 2000, ODBC, and placeholders
> 
> 
> Sorry for the repost but I left out the part of my code 
> snippet where I commit the inserts.  That is not the problem.
> 
>  
> 
> Gentlemen,
> 
>  
> 
> I'm hoping you can answer a question for me.
> 
>  
> 
> I am using an XP Pro platform accessing an MSSQL 2000 server. 
>  I use ActivePerl 5.8.4 to access my database via ODBC.  The 
> latest versions of the DBI and DBD-ODBC modules are 
> installed.  When I attempt to use placeholders in my script, 
> NOTHING HAPPENS.  The script runs to completion with no 
> errors, but no data is stored.  If I do the same thing with a 
> MySQL database, it all works OK.  Am I missing something or 
> what?  Does the MS SQL Server ODBC driver 3.8.5.1117 that my 
> DSN uses actually support placeholder use?  It would appear 
> that it does not, but does not complain either.  Below is a 
> code snippet.  Thanks in advance for any help.  In the 
> meantime, I have abandoned the placeholder concept with its 
> inherent efficiency in loops, and now use a DBI do command 
> instead.  It works, but...
> 
>  
> 
> Charles Lawrence
> 
> [EMAIL PROTECTED]
> 
>  
> 
>  
> 
> ##############################################################
> ##########
> 
>  
> 
> use strict;
> 
>  
> 
> use DBI;
> 
>  
> 
> my ($dsn_MSSQL,$dbh_MSSQL,$sth_MSSQL);
> 
>  
> 
> my $DSNname_MSSQL = 'OPERATIONS'; # DSN
> 
> my $username_MSSQL = 'operations';
> 
> my $password_MSSQL = 'qwertyuiop';
> 
>  
> 
> $dsn_MSSQL = "DBI:ODBC:$DSNname_MSSQL";
> 
>  
> 
> $dbh_MSSQL =
> DBI->connect($dsn_MSSQL,$username_MSSQL,$password_MSSQL,{RaiseError =>
> 0, PrintError => 0})
> 
>   or bail_out("   CANNOT connect to MSSQL database [$dsn_MSSQL]");
> 
>  
> 
> $sth_MSSQL = $dbh_MSSQL->prepare(qq{INSERT INTO msag 
> (pfx,streetName,rangeLow,rangeHigh,community,state,oddEven,esn
> ,[911ID],[
> date],telco,reserved,exchange,clli) VALUES
> (?,?,?,?,?,?,?,?,?,?,?,?,?,?)})
> 
>   or bail_out("   CANNOT prepare MSSQL statement for transactions");
> 
>  
> 
> $dbh_MSSQL->{RaiseError} = 1; # cause errors to raise exception
> 
> $dbh_MSSQL->{PrintError} = 0; # suppress error messages
> 
> $dbh_MSSQL->{AutoCommit} = 0; # don't commit until we say so
> 
>  
> 
> foreach ...
> 
>   {
> 
> .
> 
> .
> 
> .
> 
>           parseLine();
> 
>           storeMSSQL();
> 
> .
> 
> .
> 
> .
> 
>   }
> 
>  
> 
> $dbh_MSSQL->commit(); 
> 
> $dbh_MSSQL->disconnect();
> 
>  
> 
> exit;
> 
>  
> 
> sub parseLine($)
> 
>   {
> 
> .
> 
> .
> 
> .
> 
>   }
> 
>  
> 
> sub bail_out($)
> 
>   {
> 
>      my $message = shift;
> 
>      die("$message\nError [$DBI::err] ($DBI::errstr)\n");
> 
>   }
> 
>  
> 
> sub storeMSSQL($)
> 
>   {
> 
>      eval
> 
>        {
> 
>  
> $sth_MSSQL->execute($PFX_1,$StreetName_1,$Range_Low_1,$Range_H
> igh_1,$Com
> munity_1,$State_1,$Odd_Even_1,$ESN_1,$_911_ID_1,$Date_1,$Telco
> _1,$Reserv
> ed_1,$Exchange_1,$CLLI_1);
> 
>        };
> 
>      if ($@)
> 
>        {
> 
>           my $storeErr = $@;
> 
>           eval
> 
>             {
> 
>                $dbh_MSSQL->rollback();
> 
>                $dbh_MSSQL->disconnect();
> 
>             };
> 
>           die("A MSSQL transaction error occurred: 
> [$storeErr]\n[$linecount] records rolled back\n");
> 
>        }
> 
>   }
> 
>  
> 
> ##############################################################
> ##########
> #############
> 
> 

Reply via email to