Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: SQL Server ODBC Connection  (Read 19942 times)
ORGA-SOFT B.
Posts: 34


« on: July 11, 2018, 10:54:31 am »

Hello at all,

we are trying to use an SQL Server to store our data. Our Application Server is a Linux System.
We tried to get the connected with genero but we failed.

Perhabs someone has successful tried this scenario.

with isql or sqlcmd we can reach the db from linux.

But if we try to connect to the database with genero we get this error:

SQL: CONNECT
 | 4gl source      : testsql.4gl line=7
 | loading driver  : [/u/genero/genero_3.1/fgl/dbdrivers/dbmsnc_13]
 | snc.c:00464(3)  : Multibyte CMAX         : 6
 | snc.c:00467(1)  : Could not allocate environment handle.
 | loading driver  : [/u/genero/genero_3.1/fgl/dbdrivers/dbmdefault]
 | snc.c:00464(3)  : Multibyte CMAX         : 6
 | snc.c:00467(1)  : Could not allocate environment handle.
Program stopped at 'testsql.4gl', line number 7.
SQL statement error number -6368 (0).
SQL driver initialization function failed.

Our TestCode

       LET connstr = "db1+driver='dbmsnc_13',source='db1_dsn'"

      CONNECT TO connstr AS "db1" USER "test" USING "test"
      SELECT COUNT(*) INTO test FROM dbobjekt
      DISPLAY test

On a Windows System this works fine.
So for me it looks like GENERO misses something in his environment.
Any Ideas?

Thanks to all
Martin Stigmond
ORGA-SOFT Backnang














Daniele A.
Posts: 28


« Reply #1 on: July 11, 2018, 11:22:42 am »

Hi Martin
we use freetds+unixODBC for that  !  (working on Centos)

1.  install unixODBC  (yum install unixODBC)
2. download the freetds source end compiled it, example:
cd  /tmp/freetds-0.95.87
./configure --with-unixodbc=/usr --with-tdsver=7.3
make
make install

3. now you have the libtdsodbc.so.0 in dir. : /usr/local/lib
the next step is to setup the LD_LIBRARY_PATH by adding the new path:
export LD_LIBRARY_PATH=/usr/local/lib:$FGLDIR/lib:$LD_LIBRARY_PATH

4. configure the file /etc/odbc.ini example:
[NAMECFG]
Driver          = /usr/local/lib/libtdsodbc.so.0
Description     = MSQL Server
Trace           = No
Server          = ip_server_sqlserver
Database        = database_name
Port            = 1433
TDS_Version     = 7.3

NAMECFG: is the name you have to use in the connect statement of the BDL
Server: is the ip where sqlserver is installed
Database: is the name of the database

4. the connection string in BDL is:
connect to "NAMECFG+driver='dbmftm', username='xxx', password='yyy'"
the driver name (dbmftm) my change according to the version of BDL  (see manual).



bye

Daniele Artini

Sebastien F.
Four Js
Posts: 545


« Reply #2 on: July 11, 2018, 11:35:41 am »

Hello Martin,

The error message "Could not allocate environment handle." indicates that the MS ODBC library could not initialize properly.

We experienced that error because of a bug in MS ODBC driver, related to the location of the libmsodbcsql-13.so symbolic link, and the msodbcsqlr13.rll resource file.

The SNC ODI drivers are linked directly to libmsodbcsql-13.so or libmsodbcsql-17.so, and revealed this bug.

When using tools like sqlcmd, it goes through the ODBC driver manager to find the MS ODBC library like libmsodbcsql-13.1.so.9.0 located in a different directory, so the problem does not exist.

First you should consider to install the latest version of MS ODBC driver for Linux, namely version 17.1 (and soon 17.2 will arrive!).

Hopefully this should fix your issue.

If you still get the error, you may have a configuration issue, please contact you support channel so we can better help you.

You may want to use strace to check the system calls and figure out what happens (what .so or .rll resource files is not found)

Seb
Sebastien F.
Four Js
Posts: 545


« Reply #3 on: July 11, 2018, 11:39:15 am »

Please check:
https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-2017
Seb
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines