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

I am trying to install the DBD::ODBC module on my unix machine, so that I can use my Access Database, on my remote windows machine. (My website to communicate with my access database on my windows machine remotely).

I am getting this error in my shell:

Useless use of private variable in void context at Makefile.PL line 43 +1. Configuring DBD::ODBC ... >>> Remember to actually *READ* the README file! And re-read it if you have any problems. Using DBI 1.48 (for perl 5.008004 on i686-linux) installed in /usr/lib +/perl5/site_perl/5.8.4/i686-linux/auto/DBI/ The DBD::ODBC module needs to link with an ODBC 'Driver Manager'. (The Driver Manager, in turn, needs one or more database specific ODBC + drivers. The DBD::ODBC module does _not_ include any ODBC drivers!) You need to indicate where your ODBC Driver Manager is installed. You can do this ether by setting the ODBCHOME environment variable or by runing 'perl Makefile.PL -o odbcdir'. If you do not have an ODBC Driver Manager you can try building the free iODBC Driver Manager in the iodbcsrc directory. Makefile.PL aborted.
Like I mentioned above the Database is actually on a remote windows machine. The machine I'm installing this on, is the unix machine that I have my website running on.

I setup a DSN in the "ODBC Data Sources" on that windows machine, so that I can login to access that database. I guess that is how I need to do it. I don't know if that Windows serve actually has an sql server on it, I don't know how to tell if it does. I only use the windows server for a few things, however, those few things are imperitive to my company, thus I only use it for those purposes, and do not really know anything else about the server.

Does this DBD::ODBC module work on a unix server running perl? Or is it for a windows machine, running ActivePerl? If it can work on a unix machine, can I remote login to the access db, like I do for a mysql server?

Here is how I login to my remote database:
sub ConnectToDB { my $host_name = "01.002.003.04";# Ip Address Here my $db_name = "DataBaseName"; # Database Name to connect t +o my $dsn = "DBI:mysql:host=$host_name;database=$db_name"; return (DBI->connect ($dsn, "usernameHere", "PasswordHere" +, {PrintError => 0, RaiseError => 1})); }
So, that being the case, would this code:
sub ConnectToDB { my $host_name = "002.003.004.05"; my $db_name = "DBName"; my $dsn = "dbi:ODBC:Clients:host=$host_name;database=$db_n +ame"; return (DBI->connect ($dsn, "UserNameHere", "PassWordHere" +)); # Clients being the name I set in the Windows Data Sources (ODBC) }
Login to the remote access db?

The Readme file says this:
  set-up these environment variables:
    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
  perl Makefile.PL
  make                (or nmake, if VC++ on Win32)
  make test           (or nmake, if VC++ on Win32)
Where do I specify those at?

Thank you a ton for any help you can be...

thx,
Richard

Replies are listed 'Best First'.
Re: Help with installation and use of the DBD::ODBC module
by Errto (Vicar) on Oct 24, 2005 at 04:58 UTC
    You cannot use DBD::ODBC to connect to an ODBC data source defined on a different computer - at least not directly. You need some kind of bridge to connect the two - some of these are listed in the "Random Links" section of the DBD::ODBC documentation.
      Maybe something like DBD::Proxy, with DBD::ODBC running on the remote machine?


      Evan Carroll
      www.EvanCarroll.com
        Yes, that would work I think. In that case the steps to follow are
        1. Install Perl, DBI, and DBD::ODBC on your Windows box.
        2. Configure DBI::ProxyServer to meet your security needs.
        3. Get dbiproxy running on the Windows box, preferably as a service (but make sure this service has permissions to get at your Access file!)
        4. Use DBD::Proxy to connect to your Windows server from the Unix box.
    Re: Help with installation and use of the DBD::ODBC module
    by EvanCarroll (Chaplain) on Oct 24, 2005 at 04:49 UTC
      In bash
      export DBI_DSN='dsnhere'
      or, in perl:
      $ENV{'DBI_DSN'} = 'dsnhere';

      None of those should have to be set, the DBI_DSN/DBI_USER/DBI_PASS is only checked before the call to $dbh->connect. If you fully qualify them in the call you shouldn't need to specify them. I have no idea what ODBCHOME is, I don't use ODBC. =[



      Evan Carroll
      www.EvanCarroll.com