Zitoune has asked for the wisdom of the Perl Monks concerning the following question:

First question : I can find the driver for Microsoft SQL Server can anyone tell me where to find it ? Someone told me that you can use the one for mySql but it's not working. Second question: I have special character that i want to apppear when i'm executing my script ( é è ë etc...) but Perl is replacing them by , or other weird character . Any solution ?? Thanks

Replies are listed 'Best First'.
Re: DBI + SQL Server AND Special Character
by LTjake (Prior) on Nov 05, 2002 at 15:47 UTC
    On a Win32 system, I've had success connecting to an MS SQL 2000 server with DBD::ODBC.
    use strict; use DBI; my $server_name = 'FOO'; my $database_name = 'bar'; my $database_user = 'baz'; my $database_pass = 'xyzzy'; my $DSN = "driver={SQL Server};Server=$server_name;database=$database_ +name;uid=$database_user;pwd=$database_pass;"; my $dbh = DBI->connect("dbi:ODBC:$DSN") or die $DBI::errstr; my $sth = $dbh->prepare('EXEC my_stored_procedure'); $sth->execute or die $DBI::errstr; # ... $dbh->disconnect;
    HTH

    --
    Rock is dead. Long live paper and scissors!
      Thanks A LOT u save me a lot of time and problem too.
Re: DBI + SQL Server AND Special Character
by joe++ (Friar) on Nov 05, 2002 at 15:38 UTC
    Hi Zitoune,

    1. You should look into Free TDS and DBD::Sybase - see Re: SQL Server freeTDS walkthrough?
    2. The character set returned by SQL Server is UTF-8, so anything that is not ASCII is not represented by a single byte - you can convert these to ISO-8859-1 or something else if this doen't work for you.
    Update: forgot to mention that this assumes you're on some Un*x platfom (I implemented this on Sun Solaris some 2 years ago). For Windows you may be better off using ODBC.

    --
    Cheers, Joe