in reply to Problem getting data from win32::ODBC connection to oracle

Okay, I've never worked with Oracle (and my ODBC memory is foggy), but I'm going to take a few blind stabs in the dark here and I hope it'll be enough to get you started in the right direction.

First off,
use strict;
it's a really good habit to get into. For instance, in your script, what is $Sql_test?
Also, in the line:
$db = new Win32::ODBC("DSN=clamon.world;UID=scott;PWD=tiger");
The documentation I have suggests that you can connect with only the DSN name. (this is the part where the cross the "t's and dot the i's" comes in, but) Make sure that you have the proper driver installed for your DSN type, and try embedding the username and password in the DSN (most of the drivers I've seen will allow you to actually do that).

If in doubt, you could also use ADO (assuming you are on a windows 2000 or higher machine).
use strict; use Win32::OLE; my $db = CreateObject OLE "ADODB.Connection"; $db or die "Whoa partner!"; $db->Open("DSN=clamon.world;UID=scott;PWD=tiger"); my $rs = $db->Execute("SELECT * FROM EMP where EMPNO = 7900"); print ($_)->{Description}."<br>\n" foreach(keys %{$db->Errors()}) unle +ss($rs); while(!$rs->EOF){ #see the ADO documention for getting out the data you want $rs->MoveNext(); }
This is of course an alternate suggestion to try if you're banging your head against this horribly. Note, I haven't tested this, so treat it as if you would any psuedocode. Good luck with it.
    --jay

Replies are listed 'Best First'.
Re: Re: Problem getting data from win32::ODBC connection to oracle
by RuneK (Sexton) on Feb 08, 2002 at 11:45 UTC
    Hi, I added the use strict; but nothing out of the ordenary changed. I usually use strict. The Sql_test is now also defined(Cut/paste error as you mentioned), but that didn't do the trick either. Why must I only define the DSN name alone? I would kind of expect to use the user and password to gain access to the tabels??