Skip to Content.
Sympa Menu

freetds - Re: [freetds] Windows Question

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Windows Question
  • Date: Fri, 13 Apr 2007 23:44:09 -0400

Patrick Corbett wrote:
> I reference it in my PHP connection string the following
> way:
>
> $host = "server\instance";
> mssql_connect($host, $user, $pass);
>
> So... the question is can I use named instances...?

As stated previously, you can use the "instance" entry in freetds.conf.
That's one way.

I'm pretty sure you can use "instance\servername" with any FreeTDS
library. I know Frediano added it for ODBC
(http://www.freetds.org/userguide/odbcconnattr.htm) but istr it works
everywhere. I don't have a server to test with, but you could try bsqldb.
If it connects, PHP should be able to, too.

Take care to escape the '\' character if need be. In your example above,
you use double quotes. The PHP manual
(http://www.php.net/manual/en/language.types.string.php) says the
backslash needs to be escaped in double-quoted strings:

$host = "server\\instance";
mssql_connect($host, $user, $pass);
or
$host = 'server\instance';
mssql_connect($host, $user, $pass);

Tell us how it works out. I might need to add something to the User
Guide.

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page