Skip to Content.
Sympa Menu

freetds - Re: [freetds] unixODBC+freeTDS: DSN-less connections with defaults

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddy77 AT gmail.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] unixODBC+freeTDS: DSN-less connections with defaults
  • Date: Mon, 8 Oct 2012 18:43:49 +0100

2012/10/8 James K. Lowden <jklowden AT freetds.org>:
> On Mon, 8 Oct 2012 12:09:45 -0400
> "O'Brien, Jason K" <Jason.Obrien AT constellation.com> 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.
>

There is also a compatible syntax like Server=dnsname:port or
Server=dnsname,port (yes, ","!)

For tds version you could try to see what happen if you pass
TDS_Version to MS side, if it ignore it you can add without problems.

> 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.
>

Frediano




Archive powered by MHonArc 2.6.24.

Top of Page