Accessing SQL on a different port number (classic ASP connection string)

asp-classicconnection-string

I've got an old classic ASP site that connects to a local sql server 2000 instance. We're moving the db to a new box, and the port is non standard for sql (out of my control). .NET connection strings handle the port number fine by adding it with ,1999 after the server name/IP. The classic ASP connection string isn't working with the same syntax. I checked connectionstrings.com and couldn't find one that worked.

Current connection string (set to an Application variable in Global.asa):

Driver={SQL Server};Server=xxx.xxx.xxx.xxx;Database=dbname;Uid=dbuser;Pwd=dbpassword

I've installed the SQL Native Client and couldn't get that working either (still working on this)

Any ideas?

Best Answer

The solution was installing the SQL Native Driver from MS, then updating the connection string to the following:

Driver={SQL Native Client};Server=xxx.xxx.xxx.xxx,port;Database=dbname;Uid=dbuser;Pwd=dbpassword

I originally couldn't get it working with the SQL Native Client because of a firewall issue that was later resolved.

Related Topic