Try replacing
$db = new Win32::ODBC("MP2", "LAURIEV", "MYPSWD");
...with
$db = new Win32::ODBC("DSN=MP2;UID=LAURIEV;PWD=MYPSWD;");
This is what I got from the Win32::ODBC documentation...
It also suggests that you check to make sure that your database handle
(in this case $db) is defined before proceeding.
-----Original Message-----
From: Laurie Vien [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 04, 2004 10:57 AM
To: [EMAIL PROTECTED]
Subject: RE: Can't call Sql on an undefined value ...
I just added use of Win32::ODBC::Error(), and found out the problem is
"Default username feature not support; logon denied".
Not sure what it's calling "default username"--I used my normal login
for the database I'm trying to connect to. Does that shed more light on
it for anyone?
-----Original Message-----
From: Laurie Vien [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 04, 2004 1:52 PM
To: [EMAIL PROTECTED]
Subject: Can't call Sql on an undefined value ...
I just wrote a few lines of Perl to try to access an Oracle database via
Win32::ODBC. Running this code results in the error "Can't call method
"Sql" on an undefined value at line 6". Line 6 is the line containing
the SELECT statement.
Here's the code--what's the problem?:
#testchunk.pl
use Win32::ODBC;
$db = new Win32::ODBC("MP2", "LAURIEV", "MYPSWD");
$db->Sql("SELECT itemnum,description FROM INVY where itemnum like
'1%'");
while($db->FetchRow())
{
($the_item_num, $its_descrip) = $db->Data();
print "$the_item_num: $its_descrip\n";
}
$sql->Close();
Laurie A. Vien
Sr. Programmer/Analyst
Ben & Jerry's Homemade, Inc.