INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

DB Connection failing when connection string has password

DB Connection failing when connection string has password

(OP)
OK, I'm really at a loss on this one.

I have a small VB6 App that connects to a SQL 2005 Express database using a connection string that gets built in code.  For some reason it is failing with a "login failed for user" error when running on Vista only and the user I'm trying to login as has a password associated with it.  I'm certain that the password is getting added to the connection string correctly, 1. because it works on XP, 2. because I wrote the connection string to a file before it attempts to connect, and 3. because I can connect through osql using that same user and password. I've thought UAC may be causing it but I turned that off and it still fails.  I've thought that running the app in compatibility mode for XP SP2 but that didn't work either.  Any Ideas here are welcome.  I'm stumped.

Below are the connection strings I've tried.  The first one without the password works fine but the second one with the password does not.

"Provider=SQLOLEDB;Data Source=(local);User ID=TestUser;Initial Catalog=TestDatabase;"

"Provider=SQLOLEDB;Data Source=(local);User ID=TestUser;Password=test;Initial Catalog=TestDatabase;

RE: DB Connection failing when connection string has password

One way to prove this is to within windows create an File ODBC connection - (remembering where this is stored).
Make sure the test connection works well, once proven open the ODBC connection and check the parameters

The other thing is to ensure you can connect (via query analyser) to the DB you require using the same login and password.

BTW : The connection string looks fine to me

"I'm living so far beyond my income that we may almost be said to be living apart"

RE: DB Connection failing when connection string has password

(OP)
Thanks for the help. I'm afraid I'm not farmiliar with how to create an File ODBC Connection though.  Can you provide some instruction on how to do this?  I don't have any sort of SQL Express management studio installed on this machine.

RE: DB Connection failing when connection string has password

click start, program files, administrative tools, Data Sources. Create file DSN.
 

"I'm living so far beyond my income that we may almost be said to be living apart"

RE: DB Connection failing when connection string has password

(OP)
Alright, I did that.  Created the DSN and at the end I tested the connection using the same UID and password that I was using in the connection string and it says tests completed successfully.  Don't know where this puts me.  I guess there would have to be something wrong with the connection string?  It sure looks ok to me though.

 

RE: DB Connection failing when connection string has password

what you can do now is locate this file DSN, put it all in a single line seperated by semi-colons and then use this as your connection string.

This means its the same settings exactly.

After that, and without access to your machine, I am stumped.

"I'm living so far beyond my income that we may almost be said to be living apart"

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close