Re: osql and isql -- how to test ODBC config?

"James K. Lowden" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
On Sun, 16 Sep 2012 03:55:16 +0000
> I am not familiar with 'bsqldb'.  
> Can I just run it from bash shell prompt? 

I think you know the answer to that now, but for the record bsqldb is
documented as a man page.  "man bsqldb" is your friend.  :-)

I misled you, though.  I meant to suggest you use bsqlodbc (similarly
documented).  I hope it will do a better job of error reporting.  

Because you're using Sybase Anywhere I'll draw your attention to a
footnote in the UG:
http://www.freetds.org/userguide/freetdsconf.htm#FTN.AEN942.  

See also the "ASA database" in freetds.conf.  It might be something in
that neighborhood.  I suspect so only because I see nothing wrong with
your odbc.ini and because osql didn't report a problem.  

> Tried the following from the Linux shell prompt:  
>
> 	bsqldb -S txeis -U dba -P sql 
>
> And got the following error message:
> bsqldb: Msg 20012, Level 2 Server name not found in configuration
> files
> 
> bsqldb: Msg 20013, Level 2
> Unknown host machine name

Msg 20012 comes from FreeTDS.  It means FreeTDS couldn't convert the
provided name to an ip addreess.  The relevant part of the TDSDUMP is 

> dblib.c:7929:dbperror(0x1121510, 20013, 0)
> dblib.c:7981:20013: "Unknown host machine name"
> dblib.c:8002:"Unknown host machine name", client returns 2
> (INT_CANCEL) util.c:361:tdserror: client library returned
> TDS_INT_CANCEL(2) util.c:384:tdserror: returning TDS_INT_CANCEL(2)
> login.c:423:IP address pointer is empty
> login.c:425:Server txeis not found!

What should the "provided name" be?  Outside ODBC, servers are known to
FreeTDS by their servername, a section name in freetds.conf.  Yours is
DB246111 because 

> [DB246111]
> host = 207.235.236.120
> port = 2638
> tds version = 5.0

so your command in bsqldb would be

	$ bsqldb -S DB246111 -U dba -P sql 

just as with tsql. 

Inside ODBC, it's too dark to read.  (Apologies to Groucho Marx.) 

In odbc.ini, the servername property names a freetds.conf servername,
and the utility (bsqlodbc or isql) is provided with the DSN name (Data
Source Name, not to be confused with DNS). Yours is txeis because

> [txeis]
> Driver=FreeTDS
> Description=Sybase TXEIS Database
> Servername=DB246111
> Port=2638
> TDS_Version=5.0

so your command would be 

	$ bsqlodbc -S txeis -U dba -P sql 

HTH.  

--jkl
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.