Try to connect to Informix database Cisco UCCX with unix ODBC - no success - informix

Try to use Informix driver to connect over ODBC to Cisco UCCX database. Install IBM informix SDK
Files of SDK /opt/IBM/Informix_Client-SDK
odbcinst -j
unixODBC 2.3.9
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /home/alexniko/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
odbc.ini
[ODBC Data Sources]
uccx
uccx2
[uccx]
DRIVER={IBM INFORMIX ODBC DRIVER (64-bit)}
UID=uccxhruser
PWD=TrebuSHet{}123
DATABASE=db_cra
HOST=uccx-01.fccps.local
SERVER=uccx_01_uccx
SERVICE=1504
PROTOCOL=onsoctcp
CLIENT_LOCALE=en_US.UTF8
DB_LOCALE=en_US.UTF8
[uccx2]
DRIVER={IBM INFORMIX ODBC DRIVER 2 (64-bit)}
UID=uccxhruser
PWD=TrebuShet{}123
DATABASE=db_cra
HOST=uccx-02.fccps.local
SERVER=uccx_02_uccx
SERVICE=1504
PROTOCOL=onsoctcp
CLIENT_LOCALE=en_US.UTF8
DB_LOCALE=en_US.UTF8
odbcinst.ini
[IBM INFORMIX ODBC DRIVER (64-bit)]
Driver=/opt/IBM/Informix_Client-SDK/lib/cli/iclis09b.so
Description=IBM INFORMIX ODBC DRIVER
UID=uccxhruser
PWD=TrebuShet{}123
DATABASE=db_cra
HOST=uccx-01.fccps.local
SERVER=uccx_01_uccx
SERVICE=1504
PROTOCOL=onsoctcp
CLIENT_LOCALE=en_US.UTF8
DB_LOCALE=en_US.UTF8
[IBM INFORMIX ODBC DRIVER 2 (64-bit)]
Driver=/opt/IBM/Informix_Client-SDK/lib/cli/iclis09b.so
Description=IBM INFORMIX ODBC DRIVER
UID=uccxhruser
PWD=TrebuShet{}123
DATABASE=db_cra
HOST=uccx-02.fccps.local
SERVER=uccx_02_uccx
SERVICE=1504
PROTOCOL=onsoctcp
CLIENT_LOCALE=en_US.UTF8
DB_LOCALE=en_US.UTF8
ldd -v /opt/IBM/Informix_Client-SDK/lib/cli/iclis09b.so
Have no error
Connecttion string in python:
SERVICE=1504;PROTOCOL=onsoctcp;
CLIENT_LOCALE=en_US.UTF8;DB_LOCALE=en_US.UTF8;
DRIVER=IBM INFORMIX ODBC DRIVER (64-bit);
UID=uccxhruser;PWD=TrebuShet{}123;
DATABASE=db_cra;
HOST=uccx-01.fccps.local;
SERVER=uccx_01_uccx;
when I try to connect receive error:
Can't open lib '/opt/IBM/Informix_Client-SDK/lib/cli/iclis09b.so' : file not found (0) (SQLDriverConnect)")
Trying to check driver work with isql -v uccx - receive error
[IM002][unixODBC][Driver Manager]Data source name not found and no default driver specified
[ISQL]ERROR: Could not SQLConnect
what am I doing wrong?

Related

Tiny_tds/freetds workaround needed for Heroku

Is there any way currently to install tiny_tds on a rails 7 app in Heroku on the latest stack? All the workarounds seem to be quite old / inoperable. I am trying to get an Azure MSSQL plugin up and running on Heroku.
I have been able to get the buildpack installed, but every time I use TDS (even making a connection via a heroku rails console), I get a timeout error. If I run the exact same command locally, it works.
client = TinyTds::Client.new host: '<host>.database.windows.net', database: "<database>",username: "<username>#<host>.database.windows.net",password: "<password>", port: 1433, azure: tr
ue, tds_version: 7.4, timeout: 300, login_timeout: 300
Adaptive Server connection timed out ([server].database.windows.net:1433)
Additionally, I can run the following successfully on a heroku bash prompt:
~ $ nslookup
> <host>.database.windows.net
Server: <server ip address>
Address: <server ip address>#53
Non-authoritative answer:
<host>.database.windows.net canonical name = <other host name>.eastus.database.windows.net.
<other host name>.eastus.database.windows.net canonical name = <other host name>.trafficmanager.net.
<other host name>.trafficmanager.net canonical name = <another host name>.control.database.windows.net.
Name: <another host name>.control.database.windows.net
Address: <ip address>
~ $ nc -zv <host>.database.windows.net 1433
Connection to <host>.database.windows.net (<ip address>) 1433 port [tcp/ms-sql-s] succeeded!
I have also tried using freetds on heroku (which is required for tinytds) and get timeouts, so I believe the error traces back to freetds' interaction with heroku or the heroku buildpack, of which I have tried a variety of versions (https://github.com/rails-sqlserver/heroku-buildpack-freetds):
On my local macbook, I can run the freetds tsql connection command to connect almost instantaneously to a variety of mssql databases (one on ec2 and two on azure), but the same command times out on heroku bash prompt:
~ $ tsql -H ***.rds.amazonaws.com -p 1433 -U *** -P ***
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
103Error 20002 (severity 9):
Adaptive Server connection failed
Error 20002 (severity 9):
Adaptive Server connection failed
There was a problem connecting to the server
FreeTDS version local and remote. I did no special "configuration" file settings other than setting the TDS_VERSION to 7.3 when installing the buildpack on heroku.
# LOCAL:
$ tsql -C
Compile-time settings (established with the "configure" script)
Version: freetds v1.3.13
freetds.conf directory: /opt/homebrew/etc
MS db-lib source compatibility: no
Sybase binary compatibility: yes
Thread safety: yes
iconv library: yes
TDS version: 7.3
iODBC: no
unixodbc: yes
SSPI "trusted" logins: no
Kerberos: yes
OpenSSL: yes
GnuTLS: no
MARS: yes
# Heroku:
$ heroku run bash -a <app>
Running bash on ⬢ <app>... up, run.4557 (Hobby)
~ $ tsql -C
Compile-time settings (established with the "configure" script)
Version: freetds v1.3.13
freetds.conf directory: /app/freetds/etc
MS db-lib source compatibility: no
Sybase binary compatibility: no
Thread safety: yes
iconv library: yes
TDS version: 7.3
iODBC: no
unixodbc: no
SSPI "trusted" logins: no
Kerberos: no
OpenSSL: yes
GnuTLS: no
MARS: yes
Any ideas would be greatly appreciated!
This was due to a TLS/openssl compatibility issue. Using gnutls fixes the issue for now.
Some other notes on the issue:
https://github.com/FreeTDS/freetds/issues/336
https://github.com/FreeTDS/freetds/issues/299
If you need to use freetds on heroku-22, see this pull request.
https://github.com/rails-sqlserver/heroku-buildpack-freetds/pull/20
Many thanks to #engineersmnky for some great questions that led to discovering this answer.

Issue connecting to Noe4j Aura with Python 'neo4j' driver

I attempted to connect neo4j aura database using Python but failed as "Unable to retrieve routing information".
from neo4j import GraphDatabase
from neo4j.debug import watch
uri = "neo4j+s://<id>.databases.neo4j.io"
driver = GraphDatabase.driver(uri, auth=("neo4j", "<password>"))
def workload(tx):
return tx.run("RETURN 1 as n").data()
with watch("neo4j"): # enable logging
with driver.session() as session:
session.write_transaction(workload)
driver.close()
Running above python scripts returned the following log:
Attempting to update routing table from IPv4Address(('<id>.databases.neo4j.io', 7687))
[#0000] C: <RESOLVE> <id>.databases.neo4j.io:7687
[#0000] C: <OPEN> xx.xxx.xxx.xxx:7687
[#C000] C: <SECURE> <id>.databases.neo4j.io
[#0000] C: <CONNECTION FAILED> BoltSecurityError: [SSLCertVerificationError] Connection Failed. Please ensure that your database is listening on the correct host and port and that you have enabled encryption if required. Note that the default encryption setting has changed in Neo4j 4.0. See the docs for more information. Failed to establish encrypted connection. (code 1: Operation not permitted)
Failed to fetch routing info 35.xxx.xxx.xxx:7687
[#0000] C: <ROUTING> Deactivating address IPv4Address(('<id>.databases.neo4j.io', 7687))
[#0000] C: <ROUTING> table={None: RoutingTable(database=None routers={}, readers={}, writers={}, last_updated_time=0.235748575, ttl=0)}
Attempting to update routing table from
Unable to retrieve routing information
Transaction failed and will be retried in 1.1281720312998946s (Unable to retrieve routing information)
I looked into neo4j documentation and searched other places but none of the possible resolutions can be found.
Version:
Python 3.7.4
neo4j 4.4.2
I very much appreciate your input if you have ever experienced the same issues and found any way to resolve the issue.

Intel Edison + Ubilinux + USB to UART = USB Device not created

Dear community members,
We are working in the development of a robot autonomous control system running inside an Intel Edison, which -in turn- runs in a PixHawk automatic pilot module . This system uses ROS (Robot Operating System) and therefore we had to install Ubilinux. Our system requires being connected with a 360-degree laser (RPLIDAR-360) that sends data through a serial channel, so we are trying to get laser's data through USB-to-UART adapter (Silicon lab's CP2102) (the PixHawk only has a USB available for data transfer).
In summary, the laser is connected to the USB2UART adapter, and the adapter is connected to Edison's serial port.
However, we are stuck with some kind of driver issue. When tracing 'dmesg' the device is detected (idVendor=10c4, idProduct=ea60):
[ 917.812195] usb usb2: Product: xHCI Host Controller
[ 917.812214] usb usb2: Manufacturer: Linux 3.10.17-yocto-standard-r2 dwc-xhci
[ 917.812232] usb usb2: SerialNumber: dwc3-host.2
[ 917.812858] xHCI xhci_add_endpoint called for root hub
[ 917.812878] xHCI xhci_check_bandwidth called for root hub
[ 917.813141] hub 2-0:1.0: USB hub found
[ 917.813185] hub 2-0:1.0: 1 port detected
[ 918.128982] usb 1-1: new full-speed USB device number 2 using dwc3-host
[ 918.151786] usb 1-1: New USB device found, idVendor=10c4, idProduct=ea60
[ 918.151818] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 918.151839] usb 1-1: Product: CP2102 USB to UART Bridge Controller
[ 918.151857] usb 1-1: Manufacturer: Silicon Labs
[ 918.151875] usb 1-1: SerialNumber: 0001
With the following details:
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 0
D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=10c4 ProdID=ea60 Rev= 1.00
S: Manufacturer=Silicon Labs
S: Product=CP2102 USB to UART Bridge Controller
S: SerialNumber=0001
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
E: Ad=81(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
E: Ad=01(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
But no /dev/ttyUSBX device is created, and there are no error messages about missing Drivers or configuration failures.
We are using Ubilinux 3, which reports the following with the 'uname' command:
** 3.10.17-yocto-standard-r2
And the following is the listing of the installed drivers:
usb
/lib/modules/3.10.17-yocto-standard-r2/kernel/drivers/media/usb:
/lib/modules/3.10.17-yocto-standard-r2/kernel/drivers/media/usb/gspca:
/lib/modules/3.10.17-yocto-standard-r2/kernel/drivers/media/usb/uvc:
/lib/modules/3.10.17-yocto-standard-r2/kernel/drivers/usb:
/lib/modules/3.10.17-yocto-standard-r2/kernel/drivers/usb/gadget:
usb_f_acm.ko
/lib/modules/3.10.17-yocto-standard-r2/kernel/drivers/usb/serial:
usb_wwan.ko
Does anyone has had a similar configuration and managed to make work a CP2102 adapter?
As a last resort, we are trying to compile and install the driver by ourselves, using this reference: [url=https://askubuntu.com/questions/941594/installing-cp210x-driver]Installing CP210x Driver?Installing CP210x Driver? - Ask Ubuntu[/url]
The 'make' process crashes due to a lack of headers. We were unable to download the headers through APT, but at the end, we managed to compile the '.ko' module by downloading the headers manually from a Website.
However, after doing:
insmod cp210x.ko
We got:
Insmod: ERROR: could not insert module cp210x.ko: Invalid module format
So, at this point we have several questions... any advice about any of them would be really appreciated:
Does anybody know how to install the Kernel headers in Ubilinux - 3.10.17?
What is the official procedure to upgrade the Kernel in Ubilinux?, we already have ROS working on the board... do you think a kernel upgrade could mess our ROS configuration?
In general, do you have any successful experience in the configuration of a cp210x device?
Thanks in advance,
Héctor
The driver for cp2102 already exist in kernel, no need of extra efforts. Just use the correct udev rule file (not present by default in linux distro). An example is here. With this file /dev/ttyUSBX will be created.

Using UnixODBC and FreeTDS to connect to Pervasive SQL server in ubuntu?

I am trying to connect to a Pervasive Sql Server which is running on Windows 10 from an Ubuntu 14.04.4 server.
I am using the following services to try connect to the server:
FreeTDS
unixODBC
Before starting I tried to ping the host machine from the vm console with success.
I then run the following command to check FreeTDS has installed correctly;
tsql -C
Which returned:
Compile-time settings (established with the "configure" script)
Version: freetds v0.95.95
freetds.conf directory: /usr/local/etc
MS db-lib source compatibility: no
Sybase binary compatibility: no
Thread safety: yes
iconv library: yes
TDS version: 5.0
iODBC: no
unixodbc: yes
SSPI "trusted" logins: no
Kerberos: no
OpenSSL: no
GnuTLS: no
[freetds.conf] located in [/usr/local/etc] contains:
[PSQLServer]
host = **IP**
port = **PORT**
tds version = 8.0
[odbc.ini] located in [/usr/local/etc] contains:
[PSQLClient]
Description = Pervasive SQL Client Settings
Driver = FreeTDS
ServerName = PSQLServer
Database = **DBNAME**
Trace = No
UID = **USERNAME**
PWD = **PASSWORD**
TDS_Version = 8.0
[odbcinst.ini] located in [/usr/local/etc] contains:
[FreeTDS]
Description = FreeTDS unixODBC Driver
Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so
TDS_Version = 8.0
I tired using the tsql command adding [TDSVER=*] for each of the possible driver versions resulting in the same error message for each TDSVER.
*[5.0], *[6.0], *[7.0], *[7.1], *[7.2], *[7.3], *[7.4], *[8.0]
When testing the connection using the following command:
TDSVER=8.0 tsql -S PSQLClient -U **USERNAME** -P **PASSWORD**
Which returns the following errors:
Error 20012 (severity 2):
Server name not found in configuration files.
locale is "en_ZA.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
Error 20013 (severity 2):
Unknown host machine name.
There was a problem connecting to the server
After trying the above, I then tried to the isql command:
isql -v PSQLClient **USERNAME** **PASSWORD**
Which returns the following error messages:
[S1000][unixODBC][FreeTDS][SQL Server]Unable to connect to data source
[01000][unixODBC][FreeTDS][SQL Server]Unknown host machine name.
[ISQL]ERROR: Could not SQLConnect
Is it even possible to connect to [Pervasive SQL] via [node-odbc] and if so what am I doing wrong?
Any assistance would be greatly appreciated!
Most recent versions of Pervasive / Actian PSQL support Linux clients and have an ODBC driver for Linux. Since you're using Windows 10, you should probably be using PSQL v12. If you use v12, you can download the Linux client at http://www.pervasive.com/database/Home/Products/PSQLv12.aspx. There is an RPM and TAR available.

Ruby Sequel AS/400 connection issues

I need to connect to a AS/400 system using ODBC connection, and I'm using the Ruby sequel gem. My environment is just Ubuntu 14.04 running in virtual box. I'm able to run isql -v my.host.com and drop in to a sql console. When I try and do this from IRB, I get the error message.
require 'sequel'
db = Sequel.odbc(:drvconnect=>'driver={IBM i Access ODBC Driver};system=my.host.com;database=MYDBNAME;uid=MYUSERNAME;password=MYPASSWORD;DefaultLibraries=, *usrlibl;authentication=server')
tables = db[:QSYS2__SYSTABLES].where("TABLE_NAME like ?", "SYS%")
tables.each do |record|
puts record[:table_name]
end
#=> Sequel::DatabaseConnectionError: ODBC::Error: IM002 (0) [unixODBC][Driver Manager]Data source name not found, and no default driver specified
from /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sequel-4.32.0/lib/sequel/adapters/odbc.rb:21:in `drvconnect'
from /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sequel-4.32.0/lib/sequel/adapters/odbc.rb:21:in `connect'
from /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sequel-4.32.0/lib/sequel/connection_pool.rb:103:in `make_new'
from /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sequel-4.32.0/lib/sequel/connection_pool/threaded.rb:224:in `make_new'
from /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sequel-4.32.0/lib/sequel/connection_pool/threaded.rb:197:in `available'
from /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sequel-4.32.0/lib/sequel/connection_pool/threaded.rb:133:in `_acquire'
from /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sequel-4.32.0/lib/sequel/connection_pool/threaded.rb:147:in `block in acquire'
from /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sequel-4.32.0/lib/sequel/connection_pool/threaded.rb:265:in `block in sync'
from /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sequel-4.32.0/lib/sequel/connection_pool/threaded.rb:265:in `synchronize'
from /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sequel-4.32.0/lib/sequel/connection_pool/threaded.rb:265:in `sync'
from /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sequel-4.32.0/lib/sequel/connection_pool/threaded.rb:146:in `acquire'
from /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sequel-4.32.0/lib/sequel/connection_pool/threaded.rb:104:in `hold'
from /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sequel-4.32.0/lib/sequel/database/connecting.rb:251:in `synchronize'
from /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sequel-4.32.0/lib/sequel/adapters/odbc.rb:44:in `execute'
from /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sequel-4.32.0/lib/sequel/dataset/actions.rb:952:in `execute'
from /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sequel-4.32.0/lib/sequel/adapters/odbc.rb:97:in `fetch_rows'
from /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sequel-4.32.0/lib/sequel/dataset/actions.rb:141:in `each'
I'm not familiar at all with AS/400 or using ODBC connections, but if isql works then maybe it's a user permission error?
Here is my /etc/odbc.ini
[my.host.com]
Description = IBM i Access ODBC Driver
Driver = IBM i Access ODBC Driver
System = my.host.com
UserID = MYUSERNAME
Password = MYPASSWORD
Naming = 1
DefaultLibraries = *usrlibl;
Database = MYDBNAME
I should also mention that the AS/400 system is located remotely at the my.host.com, so I'm not trying to connect to some local running service. I am able to ping the IP address of that host though.
Edit: I've changed my driver in the drvconnect to match what's in the odbc.ini as per the suggestion below. Also I should note that I have a /etc/odbcinst.ini file with the following
[IBM i Access ODBC Driver]
Description = IBM i Access for Linux ODBC Driver
Driver = /opt/ibm/iaccess/lib/libcwbodbc.so
Setup = /opt/ibm/iaccess/lib/libcwbodbcs.so
Driver64 = /opt/ibm/iaccess/lib64/libcwbodbc.so
Setup64 = /opt/ibm/iaccess/lib64/libcwbodbcs.so
Threading = 0
DontDLClose = 1
UsageCount = 1
[IBM i Access ODBC Driver 64-bit]
Description = IBM i Access for Linux 64-bit ODBC Driver
Driver = /opt/ibm/iaccess/lib64/libcwbodbc.so
Setup = /opt/ibm/iaccess/lib64/libcwbodbcs.so
Threading = 0
DontDLClose = 1
UsageCount = 1
You have this:
require 'sequel'
db = Sequel.odbc(:drvconnect=>'driver={iSeries Access ODBC Driver}; system=my.host.com;...
But then you show this:
[my.host.com]
Description = IBM i Access ODBC Driver
Driver = IBM i Access ODBC Driver
If you actually have the IBM i Access ODBC Driver, Then that's what you should reference in your code, rather than iSeries Access ODBC Driver.
Figured it out! It turns out that when you have your /etc/odbc.ini defined with all your connection info, you don't need a connection string.
require 'sequel'
db = Sequel.odbc(drvconnect: '')
tables = db[:QSYS2__SYSTABLES].where("TABLE_NAME like ?", "SYS%")
tables.each { |r| puts r[:table_name] }
This query takes a stupid long time to run on my machine, but it does return all tables that start with "SYS". The only change I did need to make to my /etc/odbc.ini for this to work was to rename the DSN to "default"
[default]
Description = IBM i Access ODBC Driver
Driver = IBM i Access ODBC Driver
System = my.host.com
UserID = MYUSERNAME
Password = MYPASSWORD
Naming = 1
DefaultLibraries = *usrlibl;
Database = MYDBNAME
Just for anyone else that may run into this issue, here are a few other things I did along the way to get things working. My setup is Ubuntu 14.04
Install unixodbc and unixodbc-dev
My my.host.com needed to be added to my /etc/hosts since it didn't resolve on public DNS.
The driver filename I installed is called ibm-iaccess-1.1.0.4-1.0.amd64.deb
running ldd /opt/ibm/iaccess/lib64/libcwbodbc.so showed that there was a missing symlink.`
Added missing symlink for /usr/lib/x86_64-linux-gnu/libodbcinst.so.1 to /usr/lib/x86_64-linux-gnu/libodbcinst.so.2
That's it. Hope that helps other people too.

Resources