Home: Perl Programming Help: Win32 Programming Help:
Help with Win32::ODBC

New User

Dec 11, 2007, 3:13 PM

Views: 8924
Help with Win32::ODBC

Greetings all,

This is my very first perl script and I'm having a little trouble with using the Win32::ODBC module. I think the module is installed correctly. I ran the test.pl script that came in the download and the odbc connection I want to use is listed there. I've played around w/ my code quite a bit and it always results in diffrent errors (although they seem to be the same rootcause). Here are some sample script and errors:

use Win32::ODBC;
$db = new Win32::ODBC("casql100");
$db->Sql("SELECT * FROM Blah);

Can't call method "Close" on an undefined value
Can't call method "Sql" without a package or object reference

Any help or guidence is appreciated. Thanks.


Dec 11, 2007, 6:14 PM

Views: 8923
Re: [fancy_pants] Help with Win32::ODBC

Error checking should help reveal the problem:-

use Win32::ODBC; 

$db = new Win32::ODBC("casql100")
or die Win32::ODBC::Error(), "\n";


New User

Dec 12, 2007, 8:56 AM

Views: 8919
Re: [Kanji] Help with Win32::ODBC

Yes sir, I acutally figured that part out late yesterday and found that it was sending a null username and password. I changed "$db = new Win32::ODBC("casql100")" part to include that info and it connects fine now.

I guess my follow up question is why isn't it using the L/P that I have specified in the ODBC connection?