[freetds] Ms sql backslash in named instance 2005

jklowden at schemamania.org jklowden at schemamania.org
Fri Oct 23 14:53:24 EDT 2009


On Fri, Oct 23, 2009 at 06:56:00PM +0100, apk at blueyonder.co.uk wrote:
> thanks freedy and cedric for your quick response. Although that works, I'm in a difficult situation where I need it to work as before. I won't go into all the details but I have an existing app that not only uses freetds as its intended but also parses it and uses it within an application. I can't alter the app and need the functionality we have been using up to now.
> Do you know if the problem I have is a bug or a feature?

Maybe a little of both.  I would say it's undesirable.  

What's happening: tds_read_config_info() calls parse_server_name_for_port()
whose real purpose is to interpret instance\hostname and hostname:port strings.
It's not supposed to interpret the [servername] string in freetds.conf, 
but that's what it's doing.  

If you set TDSDUMPCONFIG, you'll see near the top of the log it's looking for
your 'server\name' name, and then another message, "Parsed servername, now back on 0" that means it parsed for a port number and came up with zero.  

I think the idea, once upon a time, was that 

	tsql -S 'instance\servername'
or
	tsql -S 'servername:port'

would be a way to override the instance/port in freetds.conf.  But I'm not so
sure that's such a great feature and, even if it is, it belongs properly to 
the tsql application, not libtds.  

I would try deleting the call to parse_server_name_for_port() and see if 
that solves your problem. 

HTH.

--jkl


> 
> -----Original Message-----
> 
> From:  Frediano Ziglio <freddy77 at gmail.com>
> Date:  Fri 23 Oct 2009 18:08
> 
> Il giorno ven, 23/10/2009 alle 17.46 +0100, apk at blueyonder.co.uk ha
> scritto:
> > Hi,
> > using freetds version 0.82 on solaris 10. tsql fails to connect to sql server named instances as they contain backslashes. Ie.
> > tsql -S'hostname\instancename' -U joe -P bloggs 
> > A work around is to remove the backslash in freetds.conf. However, this worked fine in freetds 0.62.4.
> > 
> > The only error is 
> > 'There was a problem connecting to the server'.
> > 
> > Its quite important that we maintain the exisiting functionality.
> > 
> > Has anyone else seen this and is there a solution that would avoid using an unstable version? 
> > 
> > 
> 
> Try -H instead of -S
> 
> freddy77



More information about the FreeTDS mailing list