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
trojan_ukAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.