Re: unixODBC+freeTDS: DSN-less connections with defaults
"James K. Lowden" <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 8 Oct 2012 12:09:45 -0400 "O'Brien, Jason K" <[email protected]> wrote: > We use DSN-less connections, so have unixODBC installed with an > odbcinst.ini entry pointing to freeTDS. This works great, except that > I can't find a way to set defaults for port or tds version. ... > it doesn't > look like the TDS ODBC driver tries to read freetds.conf at all. I > set the default TDS version when configuring, and that took care of > that, but there doesn't seem to be an analogous option for port. > > Is there any way to set the default port with the freetds odbc driver? Congratulations, your assessment is accurate. :-/ Your shortest path from where you sit may be to set TDSPORT in the environment. The second option is to connect to a named instance, even the default, MSSQLSERVER. That should get the port from port 1434 via UDP if your server is so configured. Or you could include the port in your connection string. Another alternative is to patch tds.h with a new value for TDS_DEF_PORT on line 435 or so. That's used in src/tds/config.c::tds_read_interfaces(). I don't see much point in creating a configurable default, certainly not compiled in, and probably not in a config file. A default protocol makes sense because most sites (I'd say) use either Sybase or Mircrosoft, not both, and hence save themselves some setup for the typical connection. OTOH it's relatively rare that all or even most servers at a site use the same port, unless it's the vendor's default port. HTH. --jkl