MSSQL ODBC Connection Error (NativeError: [11001] )
Hello, I need to use IRIS to connect to an MSSQL base.
It has to be done via ODBC, I can't use JDBC at this time by client option.
I am trying to use Microsoft Driver
libmsodbcsql-13.1.so.9.2
But I can't, my attempts result in:
Connection failed.
SQLState: () NativeError: [11001] Message:
I have done all DSN configuration, and my configuration is listed in SQL Gateway Connections. I know it's working, because when I run a test with isql I have the information that connects to the bank.
This is my IRIS and Server configuration:
IRIS for UNIX (Ubuntu Server LTS for x86-64) 2018.1.1 (Build 643U)
ODBC driver
Install the Microsoft ODBC driver according to your Linux operating system version by following the tutorial below:
https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15
The driver is usually installed here:
/opt/microsoft/msodbcsql/lib64
Symbolic Link
The liblber-2.4.so.2 file is usually located in the /usr/lib/x86_64-linux-gnu/ folder.
If not, use the command to find the location
find / -name liblber-2.4.so.2
After finding, create symbolic link in the <iris-install-dir>/bin folder using the command below:
ln -s /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2 liblber-2.4.so.2
ODBC Gateway 64-bit
The Microsoft ODBC connection requires a 64-bit Gateway connector, and the current one is not able to make the connection, so you must run the following commands in the <iris-install-dir>/bin folder:
Backup the default Gateway:
mv odbcgateway.so odbcgateway.so.old
Copy Gateway 64bits, and leave it as the main gateway:
cp odbcgatewayur64.so odbcgateway.so
Irisodbc.ini Configuration
Change the <iris-install-dir>/mgr/irisodbc.ini file by adding the information below:
And add the following setting
[ODBC Data Sources] Libracom = <NAME> [ <NAME> ] Driver = /opt/microsoft/msodbcsql /lib64/libmsodbcsql-13.1.so.9.2 Database = <DATABASE> Server = <HOST> Port = <PORT> UID = < USER > PWD = < PASS > locale = en_US @ collation = binary
SQL Gateway Connections
For Gateway connections the configuration created in the List must be displayed.
After configuration, click test connection to verify that it worked.
The message should appear: Connection Succeeded
@Rodolfo Moreira, thank you for posting your solution. I've been struggling with getting either ODBC or JDBC configured for communicating with MSSQL ... and while JDBC still isn't working, your post allowed me to establish an ODBC connection to the SQL server.
With IRIS 2021.1 on RHEL 8.4, the only steps (performed in <iris-install-dir>/bin) required were:
[root@HCSVR bin]# mv odbcgateway.so odbcgateway.so.old
[root@HCSVR bin]# cp odbcgatewayur64.so odbcgateway.so
[root@HCSVR bin]# chown irisusr:irisusr odbcgateway.so
Thank you @Rodolfo Moreira that's helped me a lot.