Discussion:
[freetds] osql: warning: no DNS hostname found for "192.168.10.153"
Jochen Daum
2013-01-14 23:45:31 UTC
Permalink
Hi,

I had to reinstall freetds and compiled it from the latest on
gitorius, 0.91 branch

When I do:

TDSDUMPCONFIG=stderr TDSDUMP=stderr osql -S Freshco -U sa -P pass, I get:

checking shared odbc libraries linked to isql for default directories...
strings: '': No such file
trying /tmp/sql ... no
trying /tmp/sql ... no
trying /etc ... OK
checking odbc.ini files
cannot read "/home/jochen/.odbc.ini"
reading /etc/odbc.ini
[Freshco] found in /etc/odbc.ini
found this section:
[Freshco]
Driver=FreeTDS
ServerName=freshco
Database=ExportInformationSystem
Port=1433
tds_version=7.1
looking for driver for DSN [Freshco] in /etc/odbc.ini
found driver line: " Driver=FreeTDS"
driver "FreeTDS" found for [Freshco] in odbc.ini
found driver named "FreeTDS"
"FreeTDS" is not an executable file
looking for entry named [FreeTDS] in /etc/odbcinst.ini
found driver line: " Driver = /usr/local/lib/libtdsodbc.so"
found driver /usr/local/lib/libtdsodbc.so for [FreeTDS] in odbcinst.ini
/usr/local/lib/libtdsodbc.so is an executable file
Using ODBC-Combined strategy
DSN [Freshco] has servername "freshco" (from /etc/odbc.ini)
cannot read "/home/jochen/.freetds.conf"
/usr/local/etc/freetds.conf is a readable file
looking for [freshco] in /usr/local/etc/freetds.conf
found this section:
[freshco]
host = 192.168.10.153
;host = vm
port = 1433
tds version = 7.1
looking up hostname for ip address 192.168.10.153
osql: warning: no DNS hostname found for "192.168.10.153"
Usage: host [-aCdlriTwv] [-c class] [-N ndots] [-t type] [-W time]
[-R number] [-m flag] hostname [server]


I have also added
192.168.10.153 vm
to /etc/hosts, but it cannot be resolved either

Any idea, why I can't use an IP address here?

P.S: When there is no space either side of the = on the host line, I
get "no host line found"

Kind Regards,

Jochen
Frediano Ziglio
2013-01-15 00:19:42 UTC
Permalink
Post by Jochen Daum
Hi,
I had to reinstall freetds and compiled it from the latest on
gitorius, 0.91 branch
checking shared odbc libraries linked to isql for default directories...
strings: '': No such file
trying /tmp/sql ... no
trying /tmp/sql ... no
trying /etc ... OK
checking odbc.ini files
cannot read "/home/jochen/.odbc.ini"
reading /etc/odbc.ini
[Freshco] found in /etc/odbc.ini
[Freshco]
Driver=FreeTDS
ServerName=freshco
Database=ExportInformationSystem
Port=1433
tds_version=7.1
looking for driver for DSN [Freshco] in /etc/odbc.ini
found driver line: " Driver=FreeTDS"
driver "FreeTDS" found for [Freshco] in odbc.ini
found driver named "FreeTDS"
"FreeTDS" is not an executable file
looking for entry named [FreeTDS] in /etc/odbcinst.ini
found driver line: " Driver = /usr/local/lib/libtdsodbc.so"
found driver /usr/local/lib/libtdsodbc.so for [FreeTDS] in odbcinst.ini
/usr/local/lib/libtdsodbc.so is an executable file
Using ODBC-Combined strategy
DSN [Freshco] has servername "freshco" (from /etc/odbc.ini)
cannot read "/home/jochen/.freetds.conf"
/usr/local/etc/freetds.conf is a readable file
looking for [freshco] in /usr/local/etc/freetds.conf
[freshco]
host = 192.168.10.153
;host = vm
port = 1433
tds version = 7.1
looking up hostname for ip address 192.168.10.153
osql: warning: no DNS hostname found for "192.168.10.153"
Usage: host [-aCdlriTwv] [-c class] [-N ndots] [-t type] [-W time]
[-R number] [-m flag] hostname [server]
I have also added
192.168.10.153 vm
to /etc/hosts, but it cannot be resolved either
Any idea, why I can't use an IP address here?
FreeTDS have no problem with ip here. Unless you need Kerberos I see
no problems.
Post by Jochen Daum
P.S: When there is no space either side of the = on the host line, I
get "no host line found"
Writing portable shell scripts is REALLY hard! James wrote it using
awk which personally I never didn't learn that much (perhaps cause I
learned Perl too early :) )
Post by Jochen Daum
Kind Regards,
Jochen
I see no bad configuration, we'll try to fix the problems but you can use it.
Next step is isql (or whatever your DM use).

Regards,
Frediano
Jochen Daum
2013-01-15 00:35:39 UTC
Permalink
Hi,
Post by Frediano Ziglio
I see no bad configuration, we'll try to fix the problems but you can use it.
Next step is isql (or whatever your DM use).
isql -v Freshco sa pass gives me:

[IM002][unixODBC][Driver Manager]Data source name not found, and no
default driver specified
[ISQL]ERROR: Could not SQLConnect

Same problem on php pdo as well.

Kind Regards,

Jochen
Tony Esposito
2013-01-15 15:10:04 UTC
Permalink
Question related to this issue... Why is osql even bothering to do a reverse DNS lookup of an IP address? If you do not use or have DNS this is going to fail yet it does not help me determine if my FreeTDS or ODBC is configured correctly. Please explain the usefulness of this -- or at least make it a command-line option to enable or not..
Thanks.


-----Original Message-----
From: freetds-bounces at lists.ibiblio.org [mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of Frediano Ziglio
Sent: Monday, January 14, 2013 6:20 PM
To: FreeTDS Development Group
Subject: Re: [freetds] osql: warning: no DNS hostname found for "192.168.10.153"
Post by Jochen Daum
Hi,
I had to reinstall freetds and compiled it from the latest on
gitorius, 0.91 branch
checking shared odbc libraries linked to isql for default directories...
strings: '': No such file
trying /tmp/sql ... no
trying /tmp/sql ... no
trying /etc ... OK
checking odbc.ini files
cannot read "/home/jochen/.odbc.ini"
reading /etc/odbc.ini
[Freshco] found in /etc/odbc.ini
[Freshco]
Driver=FreeTDS
ServerName=freshco
Database=ExportInformationSystem
Port=1433
tds_version=7.1
looking for driver for DSN [Freshco] in /etc/odbc.ini
found driver line: " Driver=FreeTDS"
driver "FreeTDS" found for [Freshco] in odbc.ini found driver named
"FreeTDS"
"FreeTDS" is not an executable file
looking for entry named [FreeTDS] in /etc/odbcinst.ini
found driver line: " Driver = /usr/local/lib/libtdsodbc.so"
found driver /usr/local/lib/libtdsodbc.so for [FreeTDS] in
odbcinst.ini /usr/local/lib/libtdsodbc.so is an executable file Using
ODBC-Combined strategy DSN [Freshco] has servername "freshco" (from
/etc/odbc.ini) cannot read "/home/jochen/.freetds.conf"
/usr/local/etc/freetds.conf is a readable file looking for [freshco]
[freshco]
host = 192.168.10.153
;host = vm
port = 1433
tds version = 7.1
looking up hostname for ip address 192.168.10.153
osql: warning: no DNS hostname found for "192.168.10.153"
Usage: host [-aCdlriTwv] [-c class] [-N ndots] [-t type] [-W time]
[-R number] [-m flag] hostname [server]
I have also added
192.168.10.153 vm
to /etc/hosts, but it cannot be resolved either
Any idea, why I can't use an IP address here?
FreeTDS have no problem with ip here. Unless you need Kerberos I see no problems.
Post by Jochen Daum
P.S: When there is no space either side of the = on the host line, I
get "no host line found"
Writing portable shell scripts is REALLY hard! James wrote it using awk which personally I never didn't learn that much (perhaps cause I learned Perl too early :) )
Post by Jochen Daum
Kind Regards,
Jochen
I see no bad configuration, we'll try to fix the problems but you can use it.
Next step is isql (or whatever your DM use).

Regards,
Frediano
_______________________________________________
FreeTDS mailing list
FreeTDS at lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds


-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2013.0.2890 / Virus Database: 2637/6025 - Release Date: 01/11/13
James K. Lowden
2013-01-15 20:15:15 UTC
Permalink
On Tue, 15 Jan 2013 15:10:04 +0000
Post by Tony Esposito
Why is osql even bothering to do a reverse DNS lookup of an IP
address? If you do not use or have DNS this is going to fail yet it
does not help me determine if my FreeTDS or ODBC is configured
correctly.
It shouldn't fail. It now prints a warning, as intended.

Failed reverse-lookup produces a warning because most addresses indeed
do have names. We know that because osql has been part of FreeTDS for
several years and this was the first reported reverse-lookup bug.

As a practical matter, osql locates a host "name" that can't be
verified within the confines of the machine. It may parse correctly,
but there's no way to know if it represents a valid address without
involving the network. Successful DNS lookup is necessary for a name.
For an address, successful reverse lookup indicates a valid address,
and the looked-up name may confirm to the person reading the output
that that's the intended machine.

It's certainly debatable where osql should end its verification. For
example, it could ping the address. My sense is that osql has done its
job if the configuration files have yielded a valid address for the
provided DSN.
Post by Tony Esposito
or at least make it a command-line option
One of the reasons osql was written as a shell script was to facilitate
self-diagnosis and self-repair.

--jkl

James K. Lowden
2013-01-15 04:27:25 UTC
Permalink
On Tue, 15 Jan 2013 12:45:31 +1300
Post by Jochen Daum
looking for [freshco] in /usr/local/etc/freetds.conf
[freshco]
host = 192.168.10.153
;host = vm
port = 1433
tds version = 7.1
looking up hostname for ip address 192.168.10.153
osql: warning: no DNS hostname found for "192.168.10.153"
Usage: host [-aCdlriTwv] [-c class] [-N ndots] [-t type] [-W time]
[-R number] [-m flag] hostname [server]
I have also added
192.168.10.153 vm
to /etc/hosts, but it cannot be resolved either
Any idea, why I can't use an IP address here?
You can use an IP address. You found a bug in osql. Thanks for
reporting it. The attached patch corrects it, as will the version of
osql in the next nightly snapshot.

When
$ host 192.168.10.153

returns an error, e.g.,
Host 153.10.168.192.in-addr.arpa. not found: 3(NXDOMAIN)

the string "domain" doesn't occur in the output because the
address has no name. In osql, the logic of looking for the address's
name destroys the contents of the variable HOST. When that (now empty)
variable is passed to host(1) a few lines later, it returns an error
and the script aborts.
Post by Jochen Daum
P.S: When there is no space either side of the = on the host line, I
get "no host line found"
I looked at that, too. All uses of awk(1) to split a line on the '='
sign now permit missing spaces on either side of it. Previously osql
was inconsistently stricter about whitespace.

Many Linux distributions, including e.g. Ubuntu, use mawk, which does
not recognize POSIX character classes,
cf. https://bugs.launchpad.net/ubuntu/+source/mawk/+bug/69724.

For that reason, osql now allows any number of ASCII space characters
(U+0020) but not other whitespace e.g. TAB.

HTH.

--jkl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t
Type: application/octet-stream
Size: 635 bytes
Desc: not available
Url : http://lists.ibiblio.org/pipermail/freetds/attachments/20130114/51e358d0/attachment.obj
Jochen Daum
2013-01-15 06:20:58 UTC
Permalink
Hi James,

ok great to hear this was found.

My isql problem is now resolved as well - I was missing the
"Description" keyword in odbc.ini

I'm still stuck with pdo_odbc though.

This connection string seems correct to me:

odbc:Driver=Freshco;Server=192.168.10.153;Port=1433;Database=ExportInformationSystem;UID=sa;PWD=pass

because Freshco is my DSN. It returns: SQLSTATE[IM002]
SQLDriverConnect: 0 [unixODBC][Driver Manager]Data source name not
found, and no default driver specified
I have restarted Apache, just in case.

When I try the driver name from odbcinst.ini

odbc:Driver=FreeTDS;Server=192.168.10.153;Port=1433;Database=ExportInformationSystem;UID=sa;PWD=pass

I get: SQLSTATE[08S01] SQLDriverConnect: 20009 [unixODBC][FreeTDS][SQL
Server]Unable to connect: Adaptive Server is unavailable or does not
exist

jochen at autolaptop4:~$ cat /etc/odbc.ini
[Freshco]
Driver=FreeTDS
Description=Local VM for Freshco
ServerName=192.168.10.153
Database=ExportInformationSystem
Port=1433
tds_version=7.1
jochen at autolaptop4:~$ cat /etc/odbcinst.ini
[FreeTDS]
Description = FreeTDS
Driver = /usr/local/lib/libtdsodbc.so
Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so
Trace = Yes
TraceFile = /tmp/freetds.log
FileUsage = 1
UsageCount = 1


Thanks for any further pointers.

Jochen
Loading...