• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1387
  • Last Modified:

Classic ASP connection to SQL 2005 invalid connection error

Hi,

We used to use SQL 2000 but have moved upto 2005, below is the typical connection string I used to connect to 2000 and worked fine;

objConn = "PROVIDER=SQLOLEDB;DATA SOURCE=STARGATE\STARBASE;UID=sa;PASSWORD=password;DATABASE=WEBBILL"

Below is a couple of examples of connection strings I used to connect to 2005:

objConn = "Provider=SQLNCLI;Server=MAGGIE\MAGGIE;Database=WEBBILL;Uid=sa;Pwd=password;"
objConn = "Provider=SQLOLEDB;Data Source=192.168.0.51:1433; Initial Catalog=webbill; User ID=sa; Password=parssword;"

but on any variation I get the following error:


Microsoft OLE DB Provider for SQL Server error '80004005'

[DBNETLIB][ConnectionOpen (ParseConnectParams()).]Invalid connection.

/main.asp, line 23


I'm not sure if my connections are incorrect or if it's a setup within SQL 2005
0
trojan_uk
Asked:
trojan_uk
  • 2
  • 2
1 Solution
 
brejkCommented:
When providing TCP port use comma:

objConn = "Provider=SQLOLEDB;Data Source=192.168.0.51,1433; Initial Catalog=webbill; User ID=sa; Password=parssword;"
0
 
brejkCommented:
Also use @ when using escape characters:

objConn = @"Provider=SQLNCLI;Server=MAGGIE\MAGGIE;Database=WEBBILL;Uid=sa;Pwd=password;"
0
 
trojan_ukAuthor Commented:
Thanks brejk, I changed the semi colon to a comma, now I get:

Microsoft OLE DB Provider for SQL Server error '80004005'

[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.

/main.asp, line 23

checked all the obvious things like remote access etc
0
 
trojan_ukAuthor Commented:
Ignore last comment, admin gave me the wrong IP address, should be 50 not 51....muppet
0

Featured Post

2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now