[unixODBC-support] How to odbc.ini and odbcinst.ini -- or how to Server=??? in DSN-Less connect

Michael Higgins linux at evolone.org
Mon Jun 2 16:35:43 BST 2008


Hello list --

The problem I've had is that none of the DRIVER definitions seem to get
picked up in SQLDriverConnect via perl-dbi.

I use DBD::ODBC to connect. Using a defined DSN works, but I want a
distributable app.

I should be able to specify 'Driver={}' line in DBI->connect()... but
every time this has failed with the standard, not helpful ...
[...Manager]Data source name not found and no default driver specified.

(Maybe I really don't want to do that anyway, but what if I do?)

The [Default] is specified, but not considered if I include a
'Driver={}' line. Leaving that line out allows a connect. This makes
some sense, but issuing 'Driver={Default}' doesn't work either...
should it?

That's all fine, since I finally got it to work, however, what I can't
find is a man page (or similar) that explicitly defines what is supposed
to happen with these two files and how it matters to the connect
'Driver={}' call.

I think someone posted at some point that the odbc.ini config, say, 
[BLAH]
Driver=/path/to/driver

is picked up when SQLDriverConnect sees "Driver={BLAH};". I find this
does NOT happen, but rather it just fails as above...

(I get the impression that the GUI proggy would possibly write these
files for me. That's a too windows-like for my taste and so not even
installed. I'd rather find an explanation that I can digest so to edit
correctly a working config.) '-)

/etc/unixODBC/odbc.ini 

[Default]
Driver          = /usr/lib/libtdsodbc.so

If I remove this line (and only this), then the connect doesn't work.
So the config must matter somewhere, somehow. But, what if I had a
different driver I wanted to use? And on Windows I have to have that
line (Driver=SQL Server), so was hoping/expecting to be able to specify
a linux equivalent.

Can anyone post an actual working set of config (odbc.ini,
odbcinst.ini) files for unixODBC built against freeTDS (0.6x) with a
Driver={XXX} in a SQLDriverConnect call (via perl-dbi, ideally) that
works, that I can adopt for a test?

I'll post the config I had to go with in a separate mail, for reference
if anyone else goes down this "(Driver={};)" path, it might save a lot
of wasted time. 

It seems like the How-To docs on the EasySoft site all specify some
"OOB" that doesn't exist on my system. It'd be nice if DNS-Less (sans
OOB) were more explicitly covered for unixODBC.

The docs on freeTDS make it look as if this (DNS-less connect) only
works with iODBC, since the equivalent info isn't in the unixODBC
section... 

Maybe that's pretty much true, if the Driver={XXX} line always fails?
This is why I'm soliciting a working config with that Driver={} line
honored via the unixODBC config files.

Cheers,

-- 
 |\  /|        |   |          ~ ~  
 | \/ |        |---|          `|` ?
 |    |ichael  |   |iggins    \^ /
 michael.higgins[at]evolone[dot]org



More information about the unixODBC-support mailing list