Okay, so here's the deal. I am using a Mac. This is not my fault. My work is making me. It runs OSX which I am informed is sort of like BSD. I want to connect to a MS SQL database and run a query. That's ALL, just one tiny little query. This server belongs to the client though, so can't just ssh there and run a query. And it's MSFT, so I can't use a client program and run a query. But apparently there is a way to do this with Perl.

To do this you need to download and install this thing called FreeTDS. I did this. It worked. I tested it and made a query to the DB. That worked. FreeTDS is supposed to work from within Perl though... That didn't work. You have to install either DBD::ODBC or DBD::Sybase, Sybase preferably. Sybase won't install on my machine. ODBC installs successfully! But it wants some sort of ODBC driver, which I don't understand because the driver must be there if FreeTDS is capable of running a query. So here are my two questions:

QUESTION 1

I am trying to install DBD::Sybase. I got FreeTDS running and can do queries with it from the command line, so I know that's working fine. But now I want to do queries from Perl. So I am trying to install the DBD::Sybase module. perl Makefile.pl works fine, but running make doesn't work. I am running OSX and I am having basically the same problem the guys are here:

http://www.cpanforum.com/posts/9843 http://www.cpanforum.com/posts/9851

I get this output:

rwitmers-macbook-pro-15:DBD-Sybase-1.09 rwitmer$ make cc -c -I/opt/freetds/include -DSYB_LP64 -DNO_BLK=1 -I/System/Library/Perl/Extras/5.8.8/darwin-thread-multi-2level/auto/DB +I -arch i386 -arch ppc -g -pipe -fno-common -DPERL_DARWIN -no-cpp-precom +p -fno-strict-aliasing -Wdeclaration-after-statement -I/usr/local/includ +e -O3 -DVERSION=\"1.09\" -DXS_VERSION=\"1.09\" "-I/System/Library/Perl/5.8.8/darwin-thread-multi-2level/CORE" Sybas +e.c cc -c -I/opt/freetds/include -DSYB_LP64 -DNO_BLK=1 -I/System/Library/Perl/Extras/5.8.8/darwin-thread-multi-2level/auto/DB +I -arch i386 -arch ppc -g -pipe -fno-common -DPERL_DARWIN -no-cpp-precom +p -fno-strict-aliasing -Wdeclaration-after-statement -I/usr/local/includ +e -O3 -DVERSION=\"1.09\" -DXS_VERSION=\"1.09\" "-I/System/Library/Perl/5.8.8/darwin-thread-multi-2level/CORE" dbdim +p.c dbdimp.c: In function ‘syb_init’: dbdimp.c:777: error: ‘BLK_VERSION_150’ undeclared (first use in this function) dbdimp.c:777: error: (Each undeclared identifier is reported only once dbdimp.c:777: error: for each function it appears in.) dbdimp.c:781: error: ‘BLK_VERSION_125’ undeclared (first use in this f +unction) dbdimp.c:785: error: ‘BLK_VERSION_120’ undeclared (first use in this f +unction) dbdimp.c: In function ‘syb_init’: dbdimp.c:777: error: ‘BLK_VERSION_150’ undeclared (first use in this f +unction) dbdimp.c:777: error: (Each undeclared identifier is reported only once dbdimp.c:777: error: for each function it appears in.) dbdimp.c:781: error: ‘BLK_VERSION_125’ undeclared (first use in this f +unction) dbdimp.c:785: error: ‘BLK_VERSION_120’ undeclared (first use in this f +unction) lipo: can't open input file: /var/folders/5j/5jvD0zy7GiaxVDHIL7Uk-++++TI/-Tmp-//ccad658l.out (No su +ch file or directory) make: *** [dbdimp.o] Error 1

QUESTION 2

So that's option #1, fix the Sybase module and get it to install. Option #2 is to use DBD::ODBC. I got that to install and perl seems to recognize that the module exists. Only, when I try to connect to the database it tell me that it needs a driver, like this:

rwitmers-macbook-pro-15:Documents rwitmer$ perl testFreetds.pl Unable for connect to server [iODBC][Driver Manager]Data source name n +ot found and no default driver specified. Driver could not be loaded (SQL-IM002) at testFreetds.pl line 20.

What kind of driver is it looking for and where do I find it?

The readme says to define these:

DBI_DSN The dbi data source, e.g. 'dbi:ODBC:YOUR_DSN_HERE' DBI_USER The username to use to connect to the database DBI_PASS The username to use to connect to the database ODBCHOME (Unix only) The dir your driver manager is installed in + or specify this via -o argument to Makefile.PL

I don't have ODBCHOME defined because I have no idea what a driver manager is, or whether I have it.

What is your advice on solving either of these two problems?

Thanks!
Rebecca

In reply to Problems with DBD::ODBC and DBD::Sybase by rwitmer

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.