Dhanashri Bhate wrote:
> Thanks Martin,
> After setting up the ODBC, I am trying to connect to the database, with a
> script as below
> -------------------
> #!/usr/bin/perl
> use strict;
> use warnings;
>
> use DBI;
>
> my $dbh; # the database handle
>
> my $dsn = "DBI:ODBC:orcl" ;
> my $user = "dbuser";
> my $pass = "dbpass";
>
> #connect to the database
>
> $dbh = DBI->connect ( $dsn, $user, $pass ) or die "Unable to connect:
> $DBI::errstr\n";
> -------------------
>
> When I execute this logging in as a general user or user "oracle" I get error
> like this -
>
> --------
> DBI connect('orcl','dbuser',...) failed: [unixODBC][Driver Manager]Can't open
> lib '/u01/app/oracle/lib/hsdb_odbc.so' : libhsbase.so: cannot open shared
> object file: No such file or directory (SQL-01000) at ./dbconnect.pl line 16
> Unable to connect: [unixODBC][Driver Manager]Can't open lib
> '/u01/app/oracle/lib/hsdb_odbc.so' : libhsbase.so: cannot open shared object
> file: No such file or directory (SQL-01000)
> --------
>
> Something to do with permissions,
You need to check you have read permission to /u01/app/oracle/lib and
the files in it and execute permission on the shared objects. It is not
uncommon for Oracle to be installed without these permissions.
That error is saying hsdb_odbc.so depends on libhsbase.so and it cannot
load/find it. Are you sure
I don't think hsdb_odbc is Oracle's ODBC driver - I thought it was
libsqora.so.
> because When I execute the script with root login, the error is different -
> ------
> DBI connect('orcl','dbuser',...) failed: [unixODBC][Driver Manager]Driver's
> SQLAllocHandle on SQL_HANDLE_HENV failed (SQL-IM004)
> ------
That is probably because you have not set ORACLE_HOME environment
variable properly (or the problem above).
> I googled for the errors, and have confirmed that $PATH, $ORACLE_HOME and
> $ORACLE_SID etc are set correctly for these users.
>
> Any help appreciated!
> Thanks!
First get sqlplus working. Then use unixODBC's isql to get ODBC working
(isql -v orcl dbuser dbpass) and lastly work on Perl.
>
>
> -----Original Message-----
> From: Martin Evans [mailto:[email protected]]
> Sent: Monday, June 29, 2009 4:15 PM
> To: Dhanashri Bhate
> Cc: [email protected]
> Subject: Re: Setting up ODBC connection on Linux for using DBD::ODBC
>
> Dhanashri Bhate wrote:
>> Hi All,
>> I have been working on Windows with Oracle DB and Active Perl and done some
>> DBI coding with DBD::ODBC.
>> Now I need to move things over to Linux machine ( Red Hat Linux 4 and
>> Oracle 10g.)
>> I know this is not really a DBI question, but I thought I can get good help
>> here,
>> Can someone please tell me how I set up ODBC on Linux or point me to
>> websites explaining this.
>> Thanks a lot,
>> DB
>>
>> DISCLAIMER
>> ==========
>> This e-mail may contain privileged and confidential information which is the
>> property of Persistent Systems Ltd. It is intended only for the use of the
>> individual or entity to which it is addressed. If you are not the intended
>> recipient, you are not authorized to read, retain, copy, print, distribute
>> or use this message. If you have received this communication in error,
>> please notify the sender and delete all copies of this message. Persistent
>> Systems Ltd. does not accept any liability for virus infected mails.
>>
>
> Linux/UNIX ODBC at
> http://www.easysoft.com/developer/interfaces/odbc/linux.html
> is a pretty good start at the background then
> http://www.easysoft.com/developer/languages/perl/index.html has specific
> DBD::ODBC stuff.
>
> Martin
Martin
--
Martin J. Evans
Easysoft Limited
http://www.easysoft.com