Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Using Modules

by dumbguy (Initiate)
on Dec 12, 2002 at 16:00 UTC ( #219349=perlquestion: print w/replies, xml ) Need Help??

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

Hi Monks, I am a total novice with Perl, but I'm trying! I need to use the Win32::ODBC module on a W2K workstation, but when I try, I get a message that the module can't be located. Where should Win32::ODBC be in relation to my perl.exe? Or my script? Does 'load' mean something other than making the module available in a directory? Help!! Thanks!!

Replies are listed 'Best First'.
Re: Using Modules
by earthboundmisfit (Chaplain) on Dec 12, 2002 at 16:42 UTC
    At a command prompt, type perl -V (make sure it's a capital V)... somewhere in the out put (at the end on my W2K WS) is the contents of @INC
    @INC: C:/Perl/lib C:/Perl/site/lib .
    Modules on my WS exist in either of these two directories. To install modules on Windows, try using PPM if you have the ActiveState distro or CPAN.pm if some other.
    C:\>ppm PPM interactive shell (2.1.5) - type 'help' for available commands. PPM> install DBI Install package 'DBI?' (y/N):
    BTW, I highly recommend using the DBI module over Win32::ODBC

    ---- I am what I read

      BTW, I highly recommend using the DBI module over Win32::ODBC

      Don't forget that you'll also need DBD::ODBC as well.

      -- vek --
        A lot depends on the monk's RDBMS. I prefer a native DBD::MySQL driver to the more generic ODBC connect, but to each their own.

        snippet to list ODBC data sources:

        #! perl -w use strict; use DBI; my @driver_names = DBI->available_drivers; print join("\n",@driver_names), "\n"; my @dataSources = DBI->data_sources ("ODBC"); print join("\n-",@dataSources);
        ---- I am what I read
      I downloaded the DBI module and used WINPKZIP to extract it into a folder in my perl dir. Now what? I seem to have PPM installed, but I can't find a ppd file for DBI. The docs say to copy the module into my perl directory, but I'm not sure what to copy to where. Man, I feel dumb!! Thanks for you help.
        RTFM ;-)

        You can browse the repositories and use set to tell PPM to look in the one you know has the module you want. Type help set at the PPM shell to learn about this.

        ---- I am what I read

Re: Using Modules
by John M. Dlugosz (Monsignor) on Dec 12, 2002 at 16:31 UTC
    You need to download and install that module on your machine. Read up on "PPM" (Perl Package Manager) in the ActiveState documentation. If you don't have trouble with proxies or whatnot, doing PPM install Win32-ODBC at a command-prompt should do the trick. The docs show how to manually download first if it can't handle that.
Re: Using Modules
by UnderMine (Friar) on Dec 12, 2002 at 16:35 UTC
    This sound like an installation issue. Win32::ODBC is a old method of using ODBC connections under perl. This is about 5 years old and predates Windows 2000 by some margin.

    I would recommend DBI and DBD::ODBC driver to generate more maintainable and portable code unless there is a particular reason for using Win32::ODBC (eg. legacy code). If you require multiple datasets from SQL Server which Win32::ODBC supported have a look at DBD::FreeTDS.

    Hope it helps
    UnderMine

Re: Using Modules
by meetraz (Hermit) on Dec 12, 2002 at 20:39 UTC
    I gave up on using ODBC on windows a very long time ago. Since DBI doesn't seem to have a MS-SQL interface, I currently use Win32::OLE and Microsoft's ADO library for all of my non-oracle database work. You can use Win32::OLE to create ADODB.Connection objects, run ADODB.Command objects, and eventually work on ADODB.RecordSet objects, just like you traditionally would in ASP or VB.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://219349]
Approved by Angel
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2022-09-29 18:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (125 votes). Check out past polls.

    Notices?