ODBC Connection Problem from Linux to SQL Server Daabase

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

ODBC Connection Problem from Linux to SQL Server Daabase

Funny,Solomon

Our Unix Admin installed the SQL Server ODBC Drivers for Linux on our Linux server, but when I attempt to connect to a SQL Server, I receive the following error message:

 

[IM004][unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_HENV failed

[ISQL]ERROR: Could not SQLConnect

 

I did successfully test the SQL Server authenticated account and password, I am trying to connect to within SQL server

When I googled the error, it indicated either the ODBC drivers are not mentioned properly, or environment variable are not set ODBCSYSINI ODBCINI.

 

I performed the command env from the command line and the environment variables were set ODBCSYSINI ODBCINI:

 

ODBCINI=/etc/odbc.ini

ODBCSYSINI=/etc

 

I checked the data source and driver configurations set by the Unix Admin, and they looked correct:

 

/etc/odbc.ini

[TITAN]

Description=SQL Server ODBC Driver

Driver=SQL Server Native Client 11.0

Server=nts-entdbd1

Port=1433

Database=prod01

 

/etc/odbcinst.ini

[SQL Server Native Client 11.0]

Description=Microsoft SQL Server ODBC Driver V1.0 for Linux

Driver=/usr/lib64/libodbc.so.1.0.0

Threading=1

UsageCount=1

Trace=Yes

 

This is my companies first experience with Linux ODBC, so we are not sure what the issue is.  I executed a trace for the connect string and found that several files/directories could not be found:

 

/etc/ld.so.preload                                           ===> Does not exist

/usr/lib64/tls/x86_64                                     ===> No files in /usr/lib64/tls

/usr/lib64/tls/x86_64/libodbc.so.1           ===> No files in /usr/lib64/tls

/usr/lib64/tls/libodbc.so.1                           ===> No files in /usr/lib64/tls

 

                                                                                            When I execute the find command for file libodbc.so.1, it is located in /lib64/tls/libnss_files.so.1  or /lib/libnss_files.so.1   

 

/var/run/nscd/socket                                    ===> No files in /var/run/nscd

 

/usr/lib64/tls/libnss_files.so.2                    ===> No files in /usr/lib64/tls

 

                                                                                            When I execute the find command for file libodbc.so.1, it is located in /lib64/tls/libnss_files.so.2  or /lib/libnss_files.so.2   

 

I am not sure how to point the system to these directories, as I have modified my profile to include them in the PATH, but after re-executing the profile, the connection test fails.

                                                                                               

The following is the output from executing the env command:

 

_=*29835*/bin/env

CVS_RSH=ssh

G_BROKEN_FILENAMES=1

HISTCONTROL=ignoredups

HISTSIZE=1000

HOME=/home/funnys

HOSTNAME=lx-had12

KRB5CCNAME=FILE:/tmp/krb5cc_2072_ocjbfp

LANG=en_US.UTF-8

LESSOPEN=||/usr/bin/lesspipe.sh %s

LOGNAME=funnys

MAIL=/var/spool/mail/funnys

ODBCINI=/etc/odbc.ini

ODBCSYSINI=/etc

PATH=/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/etc:/lib:/lib64

PS1=lx-had12:${LOGNAME}:${PWD}>

PWD=/home/funnys

QTDIR=/usr/lib64/qt-3.3

QTINC=/usr/lib64/qt-3.3/include

QTLIB=/usr/lib64/qt-3.3/lib

SELINUX_LEVEL_REQUESTED=

SELINUX_ROLE_REQUESTED=

SELINUX_USE_CURRENT_RANGE=

SHELL=/bin/ksh

SHLVL=1

SSH_CLIENT=10.2.202.206 52940 22

SSH_CONNECTION=10.2.202.206 52940 10.2.201.191 22

SSH_TTY=/dev/pts/0

TERM=xterm

USER=funnys

_AST_FEATURES=UNIVERSE - ucb

A__z="*SHLVL

 

Is the environment missing any variables?

 

Any assistance anyone rendered will be greatly appreciated!

 

Thank You

 

Solomon Funny

Database Services

Federal Home Loan Bank of New York

30 Montgomery Street

Jersey City, NJ 07322

(201) 356-1235

[hidden email]

 

Confidentiality Notice: The information contained in this e-mail and any attachments (including, but not limited to, any attached e-mails) may be legally privileged and confidential. If you are not an intended recipient, you are hereby notified that any dissemination, distribution or copying of this e-mail is strictly prohibited. If you have received this e-mail in error, please notify the sender and permanently delete the e-mail and any attachments immediately. You should not retain, copy or use this e-mail or any attachment for any purpose, nor disclose all or any part of the contents to any other person.
_______________________________________________
unixODBC-dev mailing list
[hidden email]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-dev
Reply | Threaded
Open this post in threaded view
|

Re: ODBC Connection Problem from Linux to SQL Server Daabase

Nick Gorham-2
On 10/03/16 19:06, Funny,Solomon wrote:

Our Unix Admin installed the SQL Server ODBC Drivers for Linux on our Linux server, but when I attempt to connect to a SQL Server, I receive the following error message:

 

[IM004][unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_HENV failed

[ISQL]ERROR: Could not SQLConnect

 

I did successfully test the SQL Server authenticated account and password, I am trying to connect to within SQL server

When I googled the error, it indicated either the ODBC drivers are not mentioned properly, or environment variable are not set ODBCSYSINI ODBCINI.

 

I performed the command env from the command line and the environment variables were set ODBCSYSINI ODBCINI:

 

ODBCINI=/etc/odbc.ini

ODBCSYSINI=/etc

 

I checked the data source and driver configurations set by the Unix Admin, and they looked correct:

 

/etc/odbc.ini

[TITAN]

Description=SQL Server ODBC Driver

Driver=SQL Server Native Client 11.0

Server=nts-entdbd1

Port=1433

Database=prod01

 

/etc/odbcinst.ini

[SQL Server Native Client 11.0]

Description=Microsoft SQL Server ODBC Driver V1.0 for Linux

Driver=/usr/lib64/libodbc.so.1.0.0

Threading=1

UsageCount=1

Trace=Yes


That driver looks like the driver manager, I would expect something like:

Driver=/opt/microsoft/msodbcsql/lib64/libmsodbcsql-11.0.so.0.0

BTW, you need to join the mailing list to post, its to prevent spam.

--
NIck

_______________________________________________
unixODBC-dev mailing list
[hidden email]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-dev
Reply | Threaded
Open this post in threaded view
|

Re: ODBC Connection Problem from Linux to SQL Server Daabase

Igor Korot
Hi,

On Fri, Mar 11, 2016 at 4:58 AM, Nick Gorham <[hidden email]> wrote:
> On 10/03/16 19:06, Funny,Solomon wrote:
>
> Our Unix Admin installed the SQL Server ODBC Drivers for Linux on our Linux
> server, but when I attempt to connect to a SQL Server, I receive the
> following error message:

Which driver do you use? Is it freeTDS or something else?
Try to install and test with the freeTDS driver.

Thank you.

>
>
>
> [IM004][unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_HENV
> failed
>
> [ISQL]ERROR: Could not SQLConnect
>
>
>
> I did successfully test the SQL Server authenticated account and password, I
> am trying to connect to within SQL server
>
> When I googled the error, it indicated either the ODBC drivers are not
> mentioned properly, or environment variable are not set ODBCSYSINI ODBCINI.
>
>
>
> I performed the command env from the command line and the environment
> variables were set ODBCSYSINI ODBCINI:
>
>
>
> ODBCINI=/etc/odbc.ini
>
> ODBCSYSINI=/etc
>
>
>
> I checked the data source and driver configurations set by the Unix Admin,
> and they looked correct:
>
>
>
> /etc/odbc.ini
>
> [TITAN]
>
> Description=SQL Server ODBC Driver
>
> Driver=SQL Server Native Client 11.0
>
> Server=nts-entdbd1
>
> Port=1433
>
> Database=prod01
>
>
>
> /etc/odbcinst.ini
>
> [SQL Server Native Client 11.0]
>
> Description=Microsoft SQL Server ODBC Driver V1.0 for Linux
>
> Driver=/usr/lib64/libodbc.so.1.0.0
>
> Threading=1
>
> UsageCount=1
>
> Trace=Yes
>
>
> That driver looks like the driver manager, I would expect something like:
>
> Driver=/opt/microsoft/msodbcsql/lib64/libmsodbcsql-11.0.so.0.0
>
> BTW, you need to join the mailing list to post, its to prevent spam.
>
> --
> NIck
>
> _______________________________________________
> unixODBC-dev mailing list
> [hidden email]
> http://mailman.unixodbc.org/mailman/listinfo/unixodbc-dev
>
_______________________________________________
unixODBC-dev mailing list
[hidden email]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-dev