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

Hi monks,
I'm looking for a ability to connect my perl-script running on Unix to a MS-SQL Database.
I tried out DBD::ODBC, but therefor a ODBC-Driver is wanted. I can't find any *free* ODBC Driver for MS-SQL Server!?
Has anyone an idea, how I can connect to MS-SQL in another way?
Or is there any free ODBC-Driver out there and I'm to dump to find it ?

Cheers
Christian

-----------------------------------
--the good, the bad and the physi--
-----------------------------------
  • Comment on searching for a perl connection to MS-SQL Server 2000

Replies are listed 'Best First'.
Re: searching for a perl connection to MS-SQL Server 2000
by marto (Cardinal) on Jul 25, 2005 at 13:13 UTC
    Hi,

    You could use DBIx::SQLEngine.
    More docs to read here.
    #!/usr/bin/perl use strict; use warnings; use DBIx::SQLEngine; eval { my $engine = DBIx::SQLEngine->new'DBI:mssql:MyDB:127.0.0.1', 'sa', 'sq +l', { RaiseError => 1, ShowErrorStatement => 1, } ); #... and so fourth....
    Update as calin states (Re^2: searching for a perl connection to MS-SQL Server 2000), an ODBC driver is required.
    Google shows some products worth checking out.
    http://www.iodbc.org/ may be worth a look.

    2nd Update
    Reading This article (off site) the author describes connecting to MS SQL via Linux. The article is on a PHP board. However the guy mentions using the TDS protocol, which may be worth investigation.

    Hope this helps

    Martin

      DBIx::SQLEngine is just a wrapper. In order to use that, the OP still needs the ODBC driver AFAICT.

Re: searching for a perl connection to MS-SQL Server 2000
by radiantmatrix (Parson) on Jul 25, 2005 at 13:54 UTC

    A quick Google search turned up an article called Connecting to MS SQL Server from Unix, which covers several ways of dealing with SQL Server from a Unix environment by using Perl.

    HTH

    <-radiant.matrix->
    Larry Wall is Yoda: there is no try{} (ok, except in Perl6; way to ruin a joke, Larry! ;P)
    The Code that can be seen is not the true Code
    "In any sufficiently large group of people, most are idiots" - Kaa's Law
      Thanks for all your replies,
      I think the best way is to buy a commercial driver...
      The DBIx thing doesn't work without any driver and to use JDBC is not my way :-)

      Thx anyway.

      Cheers physi

      -----------------------------------
      --the good, the bad and the physi--
      -----------------------------------
      
Re: searching for a perl connection to MS-SQL Server 2000
by calin (Deacon) on Jul 25, 2005 at 13:30 UTC

    I'm not familiar with the Microsoft product but I guess it supports JDBC connections drivers. If it does, enable the JDBC service on the server side then use DBD::JDBC on the client (Unix) side. In order to use DBD::JDBC you need Java to run a middleware program together with the drivers from Microsoft (not necessarily on the same computer with the client application). Just my 2c.

    Update: Another idea: run DBI::ProxyServer on a windows machine with MS SQL ODBC drivers and use DBD::Proxy on the Unix client.

    Update 2: Mixed up client-server stuff...

Re: searching for a perl connection to MS-SQL Server 2000
by mpeppler (Vicar) on Jul 25, 2005 at 16:04 UTC