Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Problem getting data from win32::ODBC connection to oracle

by Rhose (Priest)
on Feb 08, 2002 at 14:19 UTC ( [id://144106]=note: print w/replies, xml ) Need Help??


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

I know this is not the answer to the question you asked, but if you *can* use DBI/DBD:Oracle, here is some sample code which may help.

Note: The TNS name of the database may not be the same as the DSN name (actually, when you configured the DSN entry, you placed the TNS name in the server area.)

use strict; use DBI; #-- Define local constants use constant TRUE => 1; use constant FALSE => 0; use constant ORAUSER => 'scott'; use constant ORAPASS => 'tiger'; use constant ORATNS => 'clamon'; #-- Define local variables my $gDBHandle; my $gSQLCmd; my $gSQLHandle; my @gFields; #-- Connect to the database $gDBHandle = DBI->connect ( 'dbi:Oracle:' . ORATNS, ORAUSER, ORAPASS, { AutoCommit => FALSE, PrintError => FALSE, RaiseError => FALSE, } ) || die 'Could not connect to Oracle ['.$DBI::errstr.' - '.$DBI::er +r.']'; #-- Get the data $gSQLCmd = 'SELECT * FROM emp WHERE empno = ?'; $gSQLHandle = $gDBHandle->prepare ( $gSQLCmd ) || die 'Error with SQL statement ['.$DBI::errstr.' - '.$DBI::err.' +]'; $gSQLHandle->execute(7900) || die 'Error with SQL statement ['.$DBI::e +rrstr.' - '.$DBI::err.']'; while (@gFields = $gSQLHandle->fetchrow_array) { print 'Row: ',$gFields[0],"\t",$gFields[1],"\t",$gFields[2],"\n"; } #-- Close the database connection $gDBHandle->disconnect(); #-- Exit exit; #-- End of sample

I hope this helps...

Replies are listed 'Best First'.
Re: Re: Problem getting data from win32::ODBC connection to oracle
by RuneK (Sexton) on Feb 11, 2002 at 08:49 UTC
    Hi, Thanks for the help. As soon as I got the DBI module up and running everything went just fine after following you example. Thanks, RuneK

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://144106]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (2)
As of 2024-04-26 03:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found