amazonlinux / amazon-linux-2023

Amazon Linux 2023
https://aws.amazon.com/linux/amazon-linux-2023/
Other
500 stars 38 forks source link

[Bug] - Library libtdsodbc.so missing for FreeDTS #646

Open ndurchx opened 3 months ago

ndurchx commented 3 months ago

Describe the bug Connection to MSSQL Server ist not working with odbc:FreeTDS. I don´t see another possibility to connect to MSSQL.

To Reproduce Try connect via odbc to MSSQL Server; Driver FreeTDS dsn: odbc:Driver={FreeTDS};Server=;Database=

Expected behavior There should be atleast one possibility to connect to MSSQL

Error message Error: SQLSTATE[01000] SQLDriverConnect: 0 [unixODBC][Driver Manager]Can't open lib '/usr/lib64/libtdsodbc.so' : file not found

Additional context Instance class: t4g.small The missing lib is set in /etc/odbcinst.ini

# Driver from the freetds-libs package
# Setup from the unixODBC package
[FreeTDS]
Description     = Free Sybase & MS SQL Driver
Driver          = /usr/lib/libtdsodbc.so
Setup           = /usr/lib/libtdsS.so
Driver64        = /usr/lib64/libtdsodbc.so
Setup64         = /usr/lib64/libtdsS.so
Port            = 1433
zcobol commented 3 months ago

@ndurchx how did you install the freetds package? Did you build from source or downloaded binary RPMs? The driver is usually in a separate package. If you build locally it is freetds-unixodbc. Other distros will provide a freetds-libs.

The list of packages when built locally using latest stable release from ftp.freetds.org:

freetds-1.4-1.x86_64.rpm
freetds-debuginfo-1.4-1.x86_64.rpm
freetds-debugsource-1.4-1.x86_64.rpm
freetds-devel-1.4-1.x86_64.rpm
freetds-doc-1.4-1.x86_64.rpm
freetds-unixodbc-1.4-1.x86_64.rpm
freetds-unixodbc-debuginfo-1.4-1.x86_64.rpm
ndurchx commented 3 months ago

The setup has been done through AWS Elastic Beanstalk. Platform PHP 8.1 running on 64bit Amazon Linux 2023/4.1.0 freetds has already been installed on the system. The only additional install was nodejs.

zcobol commented 3 months ago

AL2023 comes with unixODBC but you still need the freetds-unixodbc package. Notice the error message '/usr/lib64/libtdsodbc.so' : file not found That's because libtdsodbc.so is provided by freetds-unixodbc:

[ec2-user] $ rpm -q --provides freetds-unixodbc
freetds-unixodbc = 1.4.10-1
freetds-unixodbc(x86-64) = 1.4.10-1
libtdsodbc.so.0()(64bit)

and /etc/odbcinst.ini entries:

[FreeTDS]
Description=FreeTDS unixODBC Driver
Driver=/usr/lib64/libtdsodbc.so.0
Setup=/usr/lib64/libtdsodbc.so.0
UsageCount=2

[SQL Server]
Description=FreeTDS unixODBC Driver
Driver=/usr/lib64/libtdsodbc.so.0
Setup=/usr/lib64/libtdsodbc.so.0
UsageCount=1
ndurchx commented 3 months ago

The package is not available. Perhaps because of the aarch64 architecture.

I solved it for me by installing the Microsoft ODBC Driver. But this should be just a temporary workaround.