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

What is the easiest way to access SQL 2005 from perl? I looked at a few of the DBD-xxx modules but can't find the correct one. Is it SQL-DB? I don't need to modify tables just access existing ones. Thx.

Replies are listed 'Best First'.
Re: SQL 2005 access
by ikegami (Patriarch) on Jun 02, 2009 at 15:22 UTC

    What is the easiest way to access SQL 2005 from perl?

    SQL is a language, not something that can be accessed. Do you mean MS SQL Server? Probably DBD::ODBC. (Can someone confirm?)

    SQL::DB is not a communication driver. While it can be used to manipulate MS SQL Server databases, you still to find an appropriate DBD first.

      Yes, I mean a way to connect to MS SQL Server.
Re: SQL 2005 access
by tweetiepooh (Hermit) on Jun 02, 2009 at 15:36 UTC
    I think DBD::Sybase will also allow connection. I use this with FreeTDS to connect to Netcool and I think connection to MSSQL is also present. You'll need to check the FreeTDS docs to set up the connection description including TDS Version which describes the sort of database. I use 5.0 to connect to Netcool and I think 8.0 is some form of MSSQL database.
Re: SQL 2005 access
by Narveson (Chaplain) on Jun 02, 2009 at 17:10 UTC

    If you're on Windows, then yes, as ikegami says, it's DBD::ODBC.

    Just for completeness, let me refer you to MSSQL::DBlib and MSSQL::Sqllib by Erland Sommarskog. These work directly with SQL Server, and don't require either ODBC or FreeTDS. On the other hand, they don't work with DBI; to use them, you'll have to learn a new interface (fully documented in the distributions).