[R-sig-DB] ODBC driver in ubuntu

Marc Schwartz m@rc_@chw@rtz @end|ng |rom me@com
Wed Oct 30 19:33:30 CET 2013


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 using 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 using gmail.com> wrote:
> 
>> 
>> I followed Lee's recommendations but still the same:
>> 
>>> library(RODBC)
>>> channel <- odbcConnect(dsn='BASTA', uid='******', pwd='*******')
>> 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 using hav.fo
>>           luridao using gmail.com
>> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
>> 
>> 
>> 
>> On Wed, Oct 30, 2013 at 3:32 PM, Lee Hachadoorian <
>> Lee.Hachadoorian+L using gmail.com> wrote:
>> 
>>> 
>>> 
>>> 
>>> On Wed, Oct 30, 2013 at 9:30 AM, Luis Ridao <luridao using gmail.com> wrote:
>>> 
>>>> You mean:
>>>> 
>>>>> channel <- odbcConnect(dsn='BASTA', uid='*****', pwd='********')
>>>> 
>>>> 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,
>>> 
>>> 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
>>> 
>> 
>> 
> 
> 
> -- 
> Lee Hachadoorian
> Asst Professor of Geography, Dartmouth College
> http://freecity.commons.gc.cuny.edu/
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-DB mailing list -- R Special Interest Group
> R-sig-DB using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-db




More information about the R-sig-DB mailing list