[unixODBC][Driver Manager] Can't open lib '/opt/cloudera/impalaodbc/lib/universal/libclouderaimpalaodbc.dylib' : file not found - odbc

I am trying to get a Cloudera Impala ODBC running on a brand new M1 Mac. To do so, I installed MS ODBC 18 via the official MS documentation and also followed the Cloudera ODBC Connector Install Guide.
However, when trying to connect, I get following error:
[Error: [odbc] Error connecting to the database] {
odbcErrors: [
{
state: '01000',
code: 0,
message: "[unixODBC][Driver Manager]Can't open lib '/opt/cloudera/impalaodbc/lib/universal/libclouderaimpalaodbc.dylib' : file not found"
}
]
}
My ODBC installation:
myuser#computer ~ % odbcinst -j
unixODBC 2.3.11
DRIVERS............: /opt/homebrew/etc/odbcinst.ini
SYSTEM DATA SOURCES: /opt/homebrew/etc/odbc.ini
FILE DATA SOURCES..: /opt/homebrew/etc/ODBCDataSources
USER DATA SOURCES..: /Users/myuser/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
odbcinst.ini
[ODBC Drivers]
Cloudera ODBC Driver for Impala = Installed
Cloudera ODBC Driver for Apache Hive = Installed
[Cloudera ODBC Driver for Impala]
Description = Cloudera ODBC Driver for Impala
Driver = /opt/cloudera/impalaodbc/lib/universal/libclouderaimpalaodbc.dylib
[Cloudera ODBC Driver for Apache Hive]
Driver = /opt/cloudera/hiveodbc/lib/universal/libclouderahiveodbc.dylib
odbc.ini
[foobarbinbaz]
Driver=/opt/cloudera/impalaodbc/lib/universal/libclouderaimpalaodbc.dylib
HOST=***
PORT=433
AuthMech=3
UseSASL=0
UID=****
PWD=****
SSL=1
TransportMode=2
HTTPPath=clicervice
CAIssuedCertNamesMismatch=1
TrustedCerts=/opt/cloudera/impalaodbc/lib/universal/cacerts.pem
TSaslTransportBufSize=1000
RowsFetchedPerBlock=10000
SocketTimeout=0
StringColumnLength=32767
UseNativeQuery=0
What I checked:
If the file /opt/cloudera/impalaodbc/lib/universal/libclouderaimpalaodbc.dylib actually exists (it does)
Interchanging Driver in my odbc.ini Cloudera ODBC Driver for Impala and /opt/cloudera/impalaodbc/lib/universal/libclouderaimpalaodbc.dylib (in both cases it's gonna search for the path)
The file /Users/myuser/.odbc.ini is actually a symlink to /Users/myuser/Library/ODBC/odbc.ini (but that shouldn't be a problem, right?)
Checked the Known Issues article at Microsoft (but I couldn't find my specific problem)
sudo chmod -R a+rw cloudera inside the /opt directory

As of v2.6.11 released 2021-03-26, the Cloudera ODBC Driver for Apache Hive does not include an ARM64 component in its universal binary. I imagine the same for the Impala driver, too.
$ file /opt/cloudera/hiveodbc/lib/universal/libclouderahiveodbc.dylib
/opt/cloudera/hiveodbc/lib/universal/libclouderahiveodbc.dylib: Mach-O universal binary with 2 architectures: [i386:Mach-O dynamically linked shared library i386
- Mach-O dynamically linked shared library i386] [x86_64]
/opt/cloudera/hiveodbc/lib/universal/libclouderahiveodbc.dylib (for architecture i386): Mach-O dynamically linked shared library i386
/opt/cloudera/hiveodbc/lib/universal/libclouderahiveodbc.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
$ lipo -archs /opt/cloudera/hiveodbc/lib/universal/libclouderahiveodbc.dylib
i386 x86_64
My system:
$ sw_vers
ProductName: macOS
ProductVersion: 12.5
BuildVersion: 21G72
$ uname -mprsv
Darwin 21.6.0 Darwin Kernel Version 21.6.0: Sat Jun 18 17:07:22 PDT 2022; root:xnu-8020.140.41~1/RELEASE_ARM64_T6000 arm64 arm
This library won't work until Cloudera updates the driver with an ARM64 version.
See also Hive ODBC driver on m1 Mac.

Related

Can't use Oracle OBDC driver in R in Mac M1 architecture

I am trying to run some queries in Oracle SQL through R using RODBC but it doesn't work, not matter what I try.
I installed the "basic", "sqlplus", "odbc" and "sdk" packages from Oracle (yes, I know sdk and sqlplus aren't strictly needed), did all the path settings needed, copied libodbcinst.2.dylib to the instant client folder, installed the odbc driver in odbcinst.ini, tried changing dynlib locations through install_name_tool, even tried adding "arch -x86_64" before the driver name on odbcinst.ini - all to no avail.
I am using a MacBook Air M1, macOS Monterey 12.3.1, unixodbc installed on opt/homebrew from homebrew...
The connection string is:
sqlDriver <- 'Oracle 19 ODBC driver'
connectionStringSQL <- paste0(
"Driver=", sqlDriver,
";Server=", sqlServer,
";Database=", sqlDatabase,
";Uid=", sqlUser,
";Pwd=", sqlPassword,
";Encrypt=yes",
";Port=1521")
conn <- odbcDriverConnect(connectionStringSQL)
But I don't think the connection string matters, because the error I get is:
Warning messages:
1: In odbcDriverConnect(connectionStringSQL) :
[RODBC] ERROR: state 01000, code 0, message [unixODBC][Driver Manager]Can't open lib 'arch -x86_64 /Users/*****/instantclient/libsqora.dylib.19.1' : file not found
2: In odbcDriverConnect(connectionStringSQL) : ODBC connection failed

Connect to HSQLDB 2.5 via Windows ODBC PostgreSQL driver

I am having a problem configuring the Windows PostgreSQL ODBC driver to connect to HSQLDB 2.5.0. As per the HSQLDB documentation I have installed version 11.01 of the PostgreSQL ODBC driver. When I test the connection from the ODBC Data Source Administrator I see the following in the ODBC log file: [0.000]Driver Version='11.01.0000,May 24 2019' linking 1915 dynamic Multithread library
[0.000]PQconnectdbParams: host='localhost' port='9001' dbname='test' user='test' sslmode='disable' password='test'
[0.109]PQsendQuery: 000000000033BCA0 'SET DateStyle = 'ISO';SET extra_float_digits = 2;show transaction_isolation'
[0.109] (ERROR) 42501 'user lacks privilege or object not found: DATESTYLE'
[1.157]PQfinish: 000000000033BCA0
It looks like the driver is sending a "SET DateStyle" command that HSQLDB doesn't understand. I've tried changing all the datasource options with no success. I have tried both the Unicode and ANSI versions of the driver.
The documentation on the web site is for version 2.5.1 which is in Release Candidate stage. You can download a snapshot jar from http://hsqldb.org/download/

Connect R to Filemaker Pro 15 on Mac

I'm trying to create a connection between R (3.3.3) Using RStudio (1.0.143) and Filemaker Pro Advanced 15 (15.0.3.305). I'm trying to create the connection using RODBC (1.3-15).
So far I:
Created a toy FM Pro database for testing
User id: Admin
Password: password
Followed these instructions for creating a DSN
Created a DSN for my toy FM Pro database called test_r
Successfully tested the connection to test_r
Unsuccessfully attempted to connect to the DSN in RStudio in the following two ways:
fm_connection <- odbcConnect(dsn="test_r", uid="Admin", pwd="password")
Which returns the following error:
[RODBC] ERROR: state IM002, code 0, message [unixODBC][Driver Manager]Data source name not found, and no default driver specifiedODBC connection failed
AND
constr <- paste("driver={FileMaker ODBC}",
"server=127.0.0.1",
"database=test_r",
"uid=Admin",
"pwd=password",
sep=";")
fm_connection <- odbcDriverConnect(constr)
Which returns the following error:
[RODBC] ERROR: state 01000, code 0, message [unixODBC][Driver Manager]Can't open lib 'FileMaker ODBC' : file not foundODBC connection failed
However, you can see that the driver is there:
Finally, I've unsuccessfully tried using these (and other) references to resolve this issue:
https://cran.r-project.org/web/packages/RODBC/vignettes/RODBC.pdf
https://community.filemaker.com/thread/165849
Nothing seems to work so far. I'm not tied to RODBC, but I do need a solution that works for Mac OS. Any help is appreciated!
Here are some imortant troubleshooting steps for MacOS. I've had the same error in R and therefore I think there's a good chance that this your issue. The setup of ODBC can be rather complicated since several software components with multiple versions are involved. You've already verified that ODBC sharing is on in this particular FileMaker database.
Verify your installation of unixodbc:
ODBC Manager is actually optional. It manages the ini files described below. But after installing unixodbc, you can also edit these ini files in a text editor without ODBC Manager.
To install Homebrew, execute this command.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then, install unixodbc. This provides for ODBC connectivity at the system level.
brew update
brew install unixodbc
Verify the driver:
The driver should be installed here:
/Library/ODBC/FileMaker\ ODBC.bundle/Contents/MacOS
That folder will contain these two files:
SetupToolTemplate fmodbc.so
Here's the full driver path:
/Library/ODBC/FileMaker\ ODBC.bundle/Contents/MacOS/fmodbc.so
Verify the config files:
The folder
/Library/ODBC
should contain these files:
FileMaker ODBC.bundle odbc.ini odbcinst.ini
Additionally, the unixodbc should contain only the latest version. If you have an earlier version, delete it. Now, only 2.3.4 is present.
/usr/local/Cellar/unixodbc/2.3.4
also contains
odbc.ini odbcinst.ini
Mirror the odbc.ini and odbcinst.ini files:
As described above, there are two copies of each of these files in two different locations. Make sure that the contents of both are equal. That means both copies of odbcinst.ini will define the drivers. And both copies of odbc.ini will contain the connections. Maybe this isn't 100% necessary, but it's what I needed to do.
Test with isql:
B:etc bobby$ isql -v DSNname admin password
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
If you still have any issues after completing these steps, please share additional details so that I can update the answer.
I got this to work using odbc instead of RODBC some new R code:
con <- DBI::dbConnect(odbc::odbc(),
driver = "/Library/ODBC/FileMaker ODBC.bundle/Contents/MacOS/FileMaker ODBC",
server = "127.0.0.1",
database = "/Users/bradcannell/Dropbox/Filemaker Pro/Notes/test_r.fmp12",
uid = "Admin",
pwd = "password")

Error IM002 with isql but odbc.ini and odbcinst.ini exist

I'm currently installing a virtuoso server on my Mac OS X.
However I got an error when I run the isql command:
isql -v 1111 dba dba
[IM002][unixODBC][Driver Manager]Data source name not found, and no defaul driver specified
[ISQL]ERROR: Could not SQLConnect
However when I tried 'odbcinst -j':
unixODBC 2.3.4
DRIVERS............: /usr/local/Cellar/unixodbc/2.3.4/etc/odbcinst.ini
SYSTEM DATA SOURCES: /usr/local/Cellar/unixodbc/2.3.4/etc/odbc.ini
FILE DATA SOURCES..: /usr/local/Cellar/unixodbc/2.3.4/etc/ODBCDataSources
USER DATA SOURCES..: /Users/francocy/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
And in each odbc.ini the driver is specified:
[virtuoso-odbc]
Driver = /usr/local/opt/virtuoso/lib/virtodbc.so
And in the odbcinst.ini:
[ODBC Data Sources]
VOS = Virtuoso
[VOS]
Driver = virtuoso-odbc
Description = Virtuoso Open-Source Edition
Address = localhost:1111
I don't understand why I get this error. I searched on the dozen of similar topic but I did not find solution.
It is weird. The problem was solved by re-installing virtuoso with homebrew and by unlinking isql from unixodbc package. It seems to have conflict regarding the isql package.

fail to make pyodbc-4.0 64bit find excel driver (windows10-64bit)

I don't catch how to connect to my excel file with pyodbc4, on windows 10 64 bit (python-3.6). As anybody a clue on my error in this code ?
import pyodbc
import os
sources = pyodbc.dataSources()
dsns = list(sources.keys())
dsns.sort()
sl = []
for dsn in dsns:
sl.append('%s [%s]' % (dsn, sources[dsn]))
print('\n'.join(sl))
# DATABASE CONNECTION
filename = 'C:\\WinPython\\basedir36\\buildZero\\winpython-64bit-3.6.x.1\\notebooks\\test.xls'
assert os.path.exists(filename)
# was wrong: CNXNSTRING = 'Driver={Microsoft Excel Driver (*.xls)};DBQ=%s;READONLY=FALSE' % filename
CNXNSTRING = 'Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=%s;READONLY=FALSE' % filename
print ('CNXNSTRING is ', CNXNSTRING)
cnxn = pyodbc.connect(CNXNSTRING, autocommit=True)
result-in-64bit:
>>>
RESTART: C:/WinPython/basedir36/buildZero/winpython-64bit3.6.x.1/notebooks/TEST6.py
Excel Files [Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)]
MS Access Database [Microsoft Access Driver (*.mdb, *.accdb)]
dBASE Files [Microsoft Access dBASE Driver (*.dbf, *.ndx, *.mdx)]
CNXNSTRING is Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=C:\WinPython\basedir36\buildZero\winpython-64bit-3.6.x.1\notebooks\test.xls;READONLY=FALSE
Traceback (most recent call last): File "C:/WinPython/basedir36/buildZero/winpython-64bit-3.6.x.1/notebooks/TEST6.py", line 17, in <module>
cnxn = pyodbc.connect(CNXNSTRING, autocommit=True)
pyodbc.Error: ('IM002', '[IM002] [Microsoft][Gestionnaire de pilotes ODBC] Source de donn�es introuvable et nom de pilote non sp�cifi� (0) (SQLDriverConnect)')
>>>
NEW findings: it works if I use pyodbc4- 32 bit and python-3.6 32 bit... so how to make it work in 64 bit ?
result-in-32bit:
>>>
RESTART: C:\WinPython\basedir36\buildZero\winpython-32bit-3.6.x.1\notebooks\TEST6.py
Excel Files [Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)]
MS Access Database [Microsoft Access Driver (*.mdb, *.accdb)]
dBASE Files [Microsoft Access dBASE Driver (*.dbf, *.ndx, *.mdx)]
CNXNSTRING is Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=C:\WinPython\basedir36\buildZero\winpython-64bit-3.6.x.1\notebooks\test.xls;READONLY=FALSE
>>>
it works if I use pyodbc4- 32 bit and python-3.6 32 bit... so how to make it work in 64 bit ?
If the script is running under 64-bit Python then it needs to have the 64-bit version of the Excel ODBC driver installed.
There is an old office 2007 32 bit on this pc
It is possible to do a "forced install" of the 64-bit Access Database Engine (which includes the Access and Excel ODBC drivers) alongside a 32-bit version of Office, but that is not recommended because in some circumstances it can break the Office install. (It is called a "forced install" because the default behaviour of the Access Database Engine installer is to prevent it from happening.)
If the "old office 2007" is no longer being used then you can uninstall it and then install the 64-bit version of the Access Database Engine. If it is still being used then you probably should just stick with running the Python script as 32-bit.

Resources