Re: [rt.cpan.org #65052] Cannot create ADODB.Connection object under Cygwin

[email protected] ("[email protected] via RT")
Newsgroups perl.libwin32
Message-ID <[email protected]>
Mon Jan 24 17:05:57 2011: Request 65052 was acted upon.
Transaction: Correspondence added by [email protected]
       Queue: Win32-OLE
     Subject: Re: [rt.cpan.org #65052] Cannot create ADODB.Connection object under Cygwin
   Broken in: 0.1709
    Severity: Important
       Owner: Nobody
  Requestors: [email protected]
      Status: open
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=65052 >


On 1/24/2011 3:59 PM, [email protected] via RT wrote:
> <URL: https://rt.cpan.org/Ticket/Display.html?id=65052>
>
> On Mon, 24 Jan 2011, Reini Urban via RT wrote:
>>> Can you please run with warnings enabled?  Win32::OLE will print
>>> additional diagnostics on OLE calls when warnings are on.
>>
>> $ perl -MWin32::OLE -wle 'print Win32::OLE->new("ADODB.Connection")'
>> Win32::OLE(0.1709) error 0x8007007e: "The specified module could not be
>> found" at -e line 1
>>          eval {...} called at -e line 1
>> Use of uninitialized value in print at -e line 1.
>
> [...]
>
>>> Is this just 32-bit ActivePerl on the same machine, or on a different
>>> one?
>>
>> I crosschecked with strawberry on the same machine, where
>> ADODB.Connection is registered.
>> c:\strawberry>  perl -MData::Dumper -MWin32::OLE -le "print
>> Dumper(Win32::OLE->new(q(ADODB.Connection)))"
>> $VAR1 = bless( {
>>                   'Properties' =>  bless( {
>
> [...]
>
> Could you try running Cygwin Perl from cmd.exe instead of bash?  I've
> found several references  with Google that certain COM components (WMI,
> ADODB) cannot be instantiated when the program is started from bash,
> but work fine when started from cmd.exe.
>
> If that is the case, start looking into differences in those environments,
> especially settings of PATH and maybe COMSPEC, and try to copy setting
> from cmd.exe to bash until it starts working.
>
> Cheers,
> -Jan

That is indeed the case.

There are a whole bunch of warnings, but the object is returned:

c:\users\rkitover>\cygwin\bin\perl -MWin32::OLE -MData::Dumper -wle 
"print Dumper(Win32::OLE->new('ADODB.Connection'))"
Win32::OLE(0.1709) error 0x8002000e: "Invalid number of parameters"
     in METHOD/PROPERTYGET "Item" at 
/usr/lib/perl5/5.10/i686-cygwin/Data/Dumper.pm line 190
Win32::OLE(0.1709) error 0x8002000e: "Invalid number of parameters"
     in METHOD/PROPERTYGET "Item" at 
/usr/lib/perl5/5.10/i686-cygwin/Data/Dumper.pm line 190
OLE exception from "ADODB.Connection":

Operation is not allowed when the object is closed.

Win32::OLE(0.1709) error 0x80020009: "Exception occurred"
     in METHOD/PROPERTYGET "DefaultDatabase" at 
/usr/lib/perl5/5.10/i686-cygwin/Data/Dumper.pm line 190
$VAR1 = bless( {
                  'Properties' => bless( {
                                           'Count' => 14,
                                           'Item' => undef
                                         }, 'Win32::OLE' ),
                  'ConnectionString' => 'Provider=MSDASQL.1',
                  'CommandTimeout' => 30,
                  'ConnectionTimeout' => 15,
                  'Version' => '6.1',
                  'Errors' => bless( {
                                       'Count' => 0,
                                       'Item' => undef
                                     }, 'Win32::OLE' ),
                  'DefaultDatabase' => undef,
                  'IsolationLevel' => 4096,
                  'Attributes' => 0,
                  'CursorLocation' => 2,
                  'Mode' => 0,
                  'Provider' => 'MSDASQL.1',
                  'State' => 0
                }, 'Win32::OLE' );
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.