Search code examples
freetdsunixodbcpervasive-sql

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!


Solution

  • 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.