RE: ORACLE DRIVER



DBI - is the perl module to handle all the request of the database, connecting, disconnecting, routing the database request to proper driver.

DBD::Oracle - is the Oracle driver that DBI can use to handle oracle request.
DBD::DB2 - for db2 database
and etc.

Here is simple dbi handle to connect to Oracle database using DBD::Oracle
driver.

$SID = Oracle database server name
my $dbh = DBI->connect('dbi:Oracle:$SID', 'cyril', 'cyril123')





Cyril.George@xxxxxxxxxxxxxxxxxx wrote: Hi Paul,
Thanks for the reply.

The perl script im using for database connection is this:
[trap is a table in my oracle database & ORACLE is the dsn name]

use DBI;
use strict;

my $dbh = DBI->connect('dbi:odbc::ORACLE', 'cyril', 'cyril123')
or die "error creating handle\n";
print "db handle success ..\n";

my $sql=qq/select * from trap/;
my $sth=$dbh->prepare($sql);

$sth->execute();
my @row;
while (@row = $sth->fetchrow_array)
{
print "inside while loop:\n";

print join(", ", @row), "\n";
}

$dbh->disconnect();
print "closed db handle:\n";


the code is working and is giving me the desired output.
But I don't know how to make a connection using DBD

Here is what I got from the internet about DBD connection
#!/usr/bin/perl

use DBI
use strict;
my $driver = "mysql";
my $database = "TESTDB";
my $dsn = "DBI:$driver:database=$database";
my $userid = "testuser";
my $password = "test123";
my $dbh = DBI->connect($dsn, $userid, $password )
or die $DBI::errstr;


so if I want to connect to oracle is it that I can put oracle in place
of mysql?
Is it something :

my $dsn = "DBI:oracle:database=dbname";
my $dbh = DBI->connect($dsn, 'cyril', 'cyril123')

or is that we have to specify the DBD to load oracle driver?

And will changing the DB handle affect the rest of the program?
Kindly put some light on this please.

Thanks
--
Regards
CyRiL.
i-flex Solutions

--


-----Original Message-----
From: Paul Gallagher [mailto:gallagher.paul@xxxxxxxxx]
Sent: Thursday, December 27, 2007 1:05 PM
To: Cyril George-SJR
Cc: dbi-users@xxxxxxxx
Subject: Re: ORACLE DRIVER

Not sure I understand why you need ODBC Cyril. What program/client are
you connecting with?

I assumed it was some perl DBI script given the mailing list this is
on. If that is the case, I'd point you again to the native Oracle DBD
+ Instant Client (for Linux). ODBC not required.

Regards,
Paul

On Dec 27, 2007 1:50 PM, wrote:
Hi Paul,
The thing is that I'm using in a Linux machine.
So I require an ODBC driver right?
So is there any free Oracle ODBC driver for Linux?
What I could gather was I should use Easysoft Oracle ODBC and unixODBC
manager
UnixODBC is a freeware but couldn't find any free Oracle Drivers.
Also if kindly suggest if there is any other alternative.

Thanks
--
Regards
CyRiL.
i-flex Solutions

--


-----Original Message-----
From: Paul Gallagher [mailto:gallagher.paul@xxxxxxxxx]
Sent: Thursday, December 27, 2007 10:23 AM
To: Cyril George-SJR
Cc: dbi-users@xxxxxxxx
Subject: Re: ORACLE DRIVER

Hi Cyril,

Oracle's own Instant Client kit should meet your needs. It is free,
even for production use.

I presume you are running under Windows, so see

http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/
winsoft.html
The main Instant Client site is at
http://www.oracle.com/technology/tech/oci/instantclient/index.html

Instant Client for Windows includes an ODBC driver, but if you are
using DBI you would probably benefit from using the native Oracle DBD
(and the Instant Client kit includes the necessary OCI support).

Regards,
Paul

On Dec 26, 2007 5:39 PM, wrote:
Hi,

I have been using easysoft odbc driver for connecting to my oracle
database.

I want to know is there a free odbc driver that I can use for this
purpose.

Kindly assist me on this.



Thanks



Regards,

Cyril Thomas George

i-flex Solutions Ltd.

*: cyril.george@xxxxxxxxxxxxxxxxxx






DISCLAIMER:
This message contains privileged and confidential information and is
intended only for an individual named. If you are not the intended
recipient, you should not disseminate, distribute, store, print, copy
or
deliver this message. Please notify the sender immediately by e-mail
if
you have received this e-mail by mistake and delete this e-mail from
your system. E-mail transmission cannot be guaranteed to be secure or
error-free as information could be intercepted, corrupted, lost,
destroyed, arrive late or incomplete or contain viruses. The sender,
therefore, does not accept liability for any errors or omissions in
the
contents of this message which arise as a result of e-mail
transmission.
If verification is required, please request a hard-copy version.



DISCLAIMER:
This message contains privileged and confidential information and is
intended only for an individual named. If you are not the intended
recipient, you should not disseminate, distribute, store, print, copy or
deliver this message. Please notify the sender immediately by e-mail if
you have received this e-mail by mistake and delete this e-mail from
your system. E-mail transmission cannot be guaranteed to be secure or
error-free as information could be intercepted, corrupted, lost,
destroyed, arrive late or incomplete or contain viruses. The sender,
therefore, does not accept liability for any errors or omissions in the
contents of this message which arise as a result of e-mail transmission.
If verification is required, please request a hard-copy version.



DISCLAIMER:
This message contains privileged and confidential information and is intended only for an individual named. If you are not the intended recipient, you should not disseminate, distribute, store, print, copy or deliver this message. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete or contain viruses. The sender, therefore, does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required, please request a hard-copy version.



---------------------------------
Never miss a thing. Make Yahoo your homepage.

Relevant Pages