Skip to content

ODBC driver in ubuntu

8 messages · Luis Ridao, Brian Ripley, Lee Hachadoorian +1 more

#
R-sig-DB help,


I'm trying to connect to an oracle database through R.
I have installed the oracle client and it seems that the driver is also
installed.
However the connection fails:
# WITH DATABASE NAME
Warning messages:
1: In odbcDriverConnect("DSN=192.168.20.10;UID=luisr;PWD=juanayzakarias") :
  [RODBC] ERROR: state IM002, code 0, message [unixODBC][Driver
Manager]Data source name not found, and no default driver specified
2: In odbcDriverConnect("DSN=192.168.20.10;UID=luisr;PWD=juanayzakarias") :
  ODBC connection failed
# WITH DATABASE IP
Warning messages:
1: In odbcDriverConnect("DSN=basta;UID=luisr;PWD=juanayzakarias") :
  [RODBC] ERROR: state IM002, code 0, message [unixODBC][Driver
Manager]Data source name not found, and no default driver specified
2: In odbcDriverConnect("DSN=basta;UID=luisr;PWD=juanayzakarias") :
  ODBC connection failed

My odbc.ini file looks like:

$ sudo gedit odbc.ini
[oracle_driver]
driver        = OracleODBC-11g
description        = Oracle_ODBC_driver
server        = basta
port        = 1521
sid        = 192.168.20.10
user        = my_uid
password        = my_pwd
logging        = No
logfile        =
enable_user_catalog        = yes
enable_synonyms        = yes
metadata_dont_change_case        = no
metadata_dont_do_schema        = no
metadata_id        = no
limit_long        = 0

$ sudo gedit odbcinst.ini
[OracleODBC-11g]
Description = Oracle ODBC driver for Oracle 11g
Driver = /u01/app/oracle/product/11.1.0/client_2/lib/libsqora.so.11.1
FileUsage = 1
Driver Logging = 7


can anyone help?

best,
Luis
#
On 30/10/2013 13:18, Luis Ridao wrote:
You have not specified a DSN called BASTA nor basta.

  
    
#
You mean:
Warning messages:
1: In odbcDriverConnect("DSN=BASTA;UID=luisr;PWD=juanayzakarias") :
  [RODBC] ERROR: state IM002, code 0, message [unixODBC][Driver
Manager]Data source name not found, and no default driver specified
2: In odbcDriverConnect("DSN=BASTA;UID=luisr;PWD=juanayzakarias") :
  ODBC connection failed

or in the odbc.ini file:
/etc$ sudo gedit odbc.ini

[oracle_driver]
driver        = OracleODBC-11g
description        = Oracle_ODBC_driver
server        = BASTA
port        = 1521
sid        = 192.168.20.10
user        = ********
password        = *********
logging        = No
logfile        =
enable_user_catalog        = yes
enable_synonyms        = yes
metadata_dont_change_case        = no
metadata_dont_do_schema        = no
metadata_id        = no
limit_long        = 0

It keeps on failing

Best,
Luis


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
Luis Ridao Cruz
Faroe Marine Research Institute
N?at?n 1, P.O. Box 3051
FO-110 T?rshavn
Faroe Islands
Tel   : (+298) 353900
Fax: : (+298) 353901
e-mail: luisr at hav.fo
           luridao at gmail.com
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
On Wed, Oct 30, 2013 at 1:22 PM, Prof Brian Ripley <ripley at stats.ox.ac.uk>wrote:

            

  
  
#
On Wed, Oct 30, 2013 at 9:30 AM, Luis Ridao <luridao at gmail.com> wrote:

            
Luis,

The name between the braces in odbc.ini is the DSN. You have named the DSN
oracle_driver, not BASTA. So either rename it in odbc.ini, or refer to it
as oracle_driver in the odbcConnect() call.

Also, I'm not really familiar with Oracle, but I can't seem to find any
information on the sid parameter you have set in the ini. The examples I
see use server, servername, and/or database. See
http://www.almahdi.cc/linux/setup-unixodbc-on-linux-for-oracle-and-sybase/.

Best,
--Lee
#
I followed Lee's recommendations but still the same:
Warning messages:
1: In odbcDriverConnect("DSN=BASTA;UID=******;PWD=**********") :
  [RODBC] ERROR: state HY000, code 12545, message
[unixODBC][Oracle][ODBC][Ora]ORA-12545: Connect failed because target host
or object does not exist
2: In odbcDriverConnect("DSN=BASTA;UID=luisr;PWD=juanayzakarias") :
  ODBC connection failed
 --------------------------------------------------------------------------------------------------
/etc$ sudo gedit odbcinst.ini
[OracleODBC-11g]
Setup           =
FileUsage =
CPTimeout =
CPReuse         =
Description = Oracle ODBC driver for Oracle 11g
Driver = /u01/app/oracle/product/11.1.0/client_2/lib/libsqora.so.11.1
FileUsage = -1
--------------------------------------------------------------------------------------------------
/etc$ sudo gedit odbc.ini
[BASTA]
driver        = OracleODBC-11g
description        = Oracle_ODBC_driver
server        = 192.168.20.10
port        = 1521
user        = ******
password        = ******
logging        = No
logfile        =
enable_user_catalog        = yes
enable_synonyms        = yes
metadata_dont_change_case        = no
metadata_dont_do_schema        = no
metadata_id        = no
limit_long        = 0


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
Luis Ridao Cruz
Faroe Marine Research Institute
N?at?n 1, P.O. Box 3051
FO-110 T?rshavn
Faroe Islands
Tel   : (+298) 353900
Fax: : (+298) 353901
e-mail: luisr at hav.fo
           luridao at gmail.com
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-



On Wed, Oct 30, 2013 at 3:32 PM, Lee Hachadoorian <
Lee.Hachadoorian+L at gmail.com> wrote:

            

  
  
#
Luis,

Respectfully, it is not the same. Previously the message was:

ERROR: state IM002, code 0, message [unixODBC][Driver
Manager]Data source name not found, and no default driver specified

Now it:

ERROR: state HY000, code 12545, message [unixODBC][Oracle][ODBC][Ora]ORA-12545:
Connect failed because target host or object does not exist

So it *is* finding the DSN in your odbc.ini, but not the "target host or
object". Are you sure the server is running and responding to other
requests? Again, I'm not familiar with Oracle, but perhaps you have to
specify a database name as well as a host? (I know on Postgres you do...).

Best,
--Lee
On Wed, Oct 30, 2013 at 11:50 AM, Luis Ridao <luridao at gmail.com> wrote:

            

  
    
#
Hi,

Been a few years since I did this on Linux for Oracle and it was on Fedora rather than Debian/Ubuntu.

That being said, there is a tnsnames.ora file that needs to be created to identify the Oracle server sid/ip and ports, there is an entry into /etc/ld.so.conf that needs to be made and ldconfig run to update the system, as well as shell environment variables that need to be created.

I found a page here:

  http://ggorjan.blogspot.com/2007/04/oracle-instantclient-odbc-on-debian.html

by Gregor Gorjanc, who is also an R user, that you might find helpful. It is a few years old, so version numbering will likely be different but the core information, I believe, is still correct.

Regards,

Marc Schwartz
On Oct 30, 2013, at 11:05 AM, Lee Hachadoorian <Lee.Hachadoorian+L at gmail.com> wrote:

            
#
thanks to Marc, Lee for their help

finally i have managed to install the odbc-driver and get it working in
ubuntu-linux

thanks also to Gregor Gorjanc's website which made it a lot easier

thanks also to Prof. Brian Ripley for its fantastic RODBC package which
makes life much easier
for many of my colleagues

best,
Luis




-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
Luis Ridao Cruz
Faroe Marine Research Institute
N?at?n 1, P.O. Box 3051
FO-110 T?rshavn
Faroe Islands
Tel   : (+298) 353900
Fax: : (+298) 353901
e-mail: luisr at hav.fo
           luridao at gmail.com
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
On Wed, Oct 30, 2013 at 6:33 PM, Marc Schwartz <marc_schwartz at me.com> wrote: