Re: [unixODBC][FreeTDS][SQL Server]Unable to connect to data source (SQL-08001)

"James K. Lowden" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
On Thu, 13 Dec 2012 18:34:49 +0530
Sankar G <[email protected]> wrote:

> Using ODBC-Combined strategy
> DSN [SERVER] has servername "" (from /usr/local/etc/odbc.ini)

I'm not sure your connection string is right in your DBD connection,
but it's always a good idea to make test your ODBC setup with osql, as
you did.  And it seems you either tickled a bug in osql or maybe
there's something else amiss.  

What's odd is that osql finds the right stanza
in /usr/local/etc/odbc.ini:

    [SERVER]
    Driver = FreeTDS
    Description = ODBC connection via FreeTDS
    ServerName = SERVER

 but then reports: 

DSN [SERVER] has servername "" (from /usr/local/etc/odbc.ini)

Looking at the osql script, I can only guess your awk works differently
from mine.  What does the following show on your computer?  I get: 

 $ SERVER_LINE='ServerName = SERVER'
 $ echo ${SERVER_LINE} | awk -F '=[[:space:]]*' '{print $2}' 
 SERVER

If yours doesn't also print 'SERVER', we need to modify osql so it
does.  If it does print 'SERVER', I don't understand how osql could
find the right line and not parse it correctly.  

To isolate yourself from Perl *and* osql bugs, you could always try

	$ TDSVER=7.2 bsqlodbc -S SERVER -U username -P password

(sudo shouldn't be necessary.) 

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.