0

I am trying to connect to a Pervasive Sql Server which is running on Windows machine from my Ruby application which is on Ubuntu Machine. Can Someone please help me on same. Thanks in advance

Below is my configuration on linux machine

/etc/freetds/freetds.conf

[pserver]
  host = XXX.XXX.XX.XXX
  port = 1583
  tds version = 8.0

Under /etc/odbcinst.ini, I have saved the driver info like below

[freetds]
  Description=freetds Driver
  Driver=/usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
  Setup=/usr/lib/x86_64-linux-gnu/odbc/libtdsS.so
  Trace=Yes
  TraceFile=/tmp/freetds.log
  ForceTrave=Yes
  UsageCount=10
  fileusage=1
  dontdlclose=1
  TDS_Version = 8.0

In /etc/odbc.ini, client and database details

[pclient]
    Description     = Pervasive SQL Server
    Driver          = freetds
    Trace           = Yes
    Servername      = pserver
    Port            = 1583
    Database        = "MyDatabasename"
    TDS_Version     = 8.0
tsql -S pserver -U db_username -P db_password -d MyDatabasename

above cmd gives error saying Error 20009 (severity 9): Unable to connect: Adaptive Server is unavailable or does not exist OS error 111, "Connection refused" There was a problem connecting to the server

 iodbctest ["DSN=pclient;UID=db_username;PWD=db_password"]
this results in
iODBC Demonstration program
This program shows an interactive SQL processor
Driver Manager: 03.52.0812.0326

(iodbctest:6672): Gtk-WARNING **: 20:40:38.693: cannot open display:

Not able to understand the above result and how to handle this. Please help

user2606741
  • 51
  • 1
  • 4

1 Answers1

0

As far as I know, the only way to access Pervasive PSQL from Ruby would be through ODBC. You need to use the Pervasive Client ODBC driver. Don't use the FreeTDS driver. I've never heard of using the FreeTDS driver to connect to Pervasive PSQL. In fact, this question mentions that FreeTDS doesn't work to Pervasive PSQL. Pervasive PSQL and Microsoft SQL Server are not the same product and the client for one cannot connect to the server of the other.

The short answer would be to install the Pervasive PSQL client on the Ubuntu machine, create the ODBC Datasource name pointing to the database on the Windows machine and then use ODBC from within Ruby to access the data.
You'll want to be on at least Pervasive PSQL v11.30, preferably Actian PSQL v13 (current version as of December 2018). You'll need to download and install the client appropriate for the application. If the Ruby application is 32 bit, you need the 32 bit ODBC driver. If the application is 64 bit, you'll need the 64 bit driver. The 'bitness' of the OS is not as important. You need to use the same PSQL client version as server version. You cannot use the v13 client with a v11 server.

mirtheil
  • 8,952
  • 1
  • 30
  • 29
  • I tried with ODBC connection, but it fails every time. I installed PSQL v11.30 on a windows machine which is running on a network. And then get connected it to Razor SQL using ODBC data source on the same machine. Now I am trying to access PSQL Database from linux machine on different network using freetds and ODBC for Ruby application. But not succeeded yet. Please guide me on same. – user2606741 Dec 22 '18 at 08:14
  • Can't guide you if you don't give more information. Does the Pervasive ODBC drive on Linux connect to the Pervasive Server on Windows? If not, get that working before trying in Ruby. If it isn't working, post the error. – mirtheil Dec 22 '18 at 13:01