SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Old Forums
 CLOSED - General SQL Server
 connecting using DSN file
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

AskSQLTeam
Ask SQLTeam Question

USA
0 Posts

Posted - 04/10/2002 :  08:51:12  Show Profile  Visit AskSQLTeam's Homepage
UnkleVo writes "When I am trying to connect using DSN file it gives me an error "Login failed for user <user_name>"
(conn.Open "FILEDSN=c:/mydsnfile.dsn")

It works when I am using the same user to connect using DSN-less connection.
("Provider=sqloledb;Data Source=MYSERVER;User ID=MyUser;Password=MyPassword;")


Also,if I add a password to the connection string after I indicate the path to DSN file it also works. (conn.Open "FILEDSN=c:/mydsnfile.dsn;PWD=MyPassword")

I have a user set up in SQL server which I use in my DSN file.

It is part of public and db_owner database roles.

Hope you can help me.

Thank you."

chadmat
The Chadinator

USA
1974 Posts

Posted - 04/10/2002 :  18:34:38  Show Profile  Visit chadmat's Homepage
File DSNs do note store password info in the file. You have to pass it in your connection string.

It would be a security risk to store it in the file.

-Chad

Go to Top of Page

AjarnMark
SQL Slashing Gunting Master

USA
3246 Posts

Posted - 04/10/2002 :  20:18:34  Show Profile  Visit AjarnMark's Homepage
Wouldn't a System DSN be a better choice here?

------------------------
GENERAL-ly speaking...
Go to Top of Page

isharko
Starting Member

USA
7 Posts

Posted - 04/15/2002 :  11:31:35  Show Profile
quote:

Wouldn't a System DSN be a better choice here?

------------------------
GENERAL-ly speaking...



Go to Top of Page

isharko
Starting Member

USA
7 Posts

Posted - 04/16/2002 :  11:34:13  Show Profile
Is there a way to avoid hardcoding a UID and PWD into a connection string
when using system DSN.

Now I am using strConnString = "DSN=MyDsn;UID=MyUserID;PWD=MyPassword"

I don't want to hardcode UID and PWD into my app because DBA (that do not
have an access to the app source files) would like to be able to change user
and password for DB connection used in this app.

Thanks.



Go to Top of Page

robvolk
Most Valuable Yak

USA
15659 Posts

Posted - 04/16/2002 :  11:46:21  Show Profile  Visit robvolk's Homepage
Why not just use a DSN-less connection? It's very easy to build all of the required elements for a connection string from either user input or system data, or both. The user can be prompted for both a user name and password if desired, or a password only. You'll see this on web sites (Yahoo! Mail, for example) where they give you the option of signing in as a different user, or maintaining the same user account (you still need to enter a password)

IMHO DSNs are not worth the hassle anymore, especially if you're using ADO to connect to a database. They really don't provide any benefit.

Go to Top of Page

isharko
Starting Member

USA
7 Posts

Posted - 04/16/2002 :  14:53:27  Show Profile
Yes, the DSN-less connections are great I was using it all the time before.

But the problem is that my management decided to host my web application somewhere else (another city) and they don't want the uid and password hardcoded into my app. The DBA wants to be able to create a database for this app and place it at any location he likes. If we use DSN than he can simply configure DSN without contacting me (developer). If we use DSN-less connection I have to send him updated version of my VB component.

Any thoughts?

Thanks for your help.


Go to Top of Page

izaltsman
A custom title

USA
1139 Posts

Posted - 04/16/2002 :  15:24:47  Show Profile  Send izaltsman an AOL message  Send izaltsman an ICQ Message
Basically this is your classic trade-off between security and usability...

If you feel comfortable keeping your password in a file, there is no reason why you can't create an ini file that your application would read on start-up. This file can contain all the configuration parameters needed by your application, including your database password (possibly encrypted using Crypto API or something).

---------------
Strong SQL Developer wanted in the Boston area. Please e-mail if interested.

Edited by - izaltsman on 04/16/2002 15:25:58
Go to Top of Page

sqlxpert
Starting Member

11 Posts

Posted - 04/16/2002 :  15:34:26  Show Profile
U can also use PWD file this will be having encrypted password and can be generated by a dba when ever required using keygen.

AB

Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000