in reply to Using DBD::ODBC and cygwin to connect to MS SQL?

is the database on the same host or on a different one? Perhaps Connect to remote MSSQL database with DBD-ODBC? has helpful hints.

Anyway, I would've thought DBI "alone", plus DBD::ODBC of course, should be sufficient. But … do you have the corresponding ODBC Driver (for MS SQL) installed?

  • Comment on Re: Using DBD::ODBC and cygwin to connect to MS SQL?

Replies are listed 'Best First'.
Re^2: Using DBD::ODBC and cygwin to connect to MS SQL?
by Tommy (Chaplain) on Jul 13, 2016 at 15:13 UTC

    Thanks for the reply, soonix. This is all new territory for me. I've only ever worked with databases running on Linux/UNIX servers before. I'd like to keep it as simple as possible, but I've read that I need to set up unixodbc and freetds to get this to work. Am I missing something?

    The reference I've been using so far is this StackOverflow post. How do you recommend I do it?

    Tommy
    A mistake can be valuable or costly, depending on how faithfully you pursue correction
      Well, to find out wether the stumbling block is Perl, ODBC, some driver or even the database configuration, I'd try to connect to the database via the most simple tool. "Simple" in this case means: pre-existing and easily configured.

      If you're on Windows, you might have MS Access or Excel, both of which can connect to "external" sources, hidden under something like "Import external data".

      There probably is the possibility to use native MSSQL. I'd try this first to see if the database is reachable at all.
      I know cygwin Perl only from hearsay, but chances are that instead of DBD::ODBC you could also use DBD::ADO (I use this with Strawberry Perl), which AFAIK uses the same "native" drivers as Excel/Access.

      Then I'd try ODBC (probably under "other", where you will have to select in a next step some "data source". If it is not already set up for you, you'll need it for Perl, too, anyway.

      After you got that working, you can extract the connection string from the connection's properties within Excel/Access

      updated "set up" url