Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO - Connect using DSN without UID/PWD

Status
Not open for further replies.

karthik555

IS-IT--Management
Oct 15, 2002
36
IN
If any one has any idea to do this, will be helpful..

1. I am trying to connect to my SQL Server database using a DSN.
2. I have given UID/PWD (SQL Authentication) in my DSN and have given a default DB.
3. I am trying to execute the following code in VB
<CODE>
Dim oADO As ADODB.Connection
Dim oRS As ADODB.Recordset
Dim str As String
Set oADO = New ADODB.Connection
oADO.ConnectionString = "DSN=myDSN"
oADO.Open
</CODE>
4. I am getting error [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.

Thanks in Advance..
Karthik
 
You need to give the user information on the connection, not on the DSN. Alternativelly you use "trusted connections" logins to the SQL Server.

No way around this.

Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Thanks...

Is there any reason why it should not be that way...

We still provide UID/PWD while creating a DSN.

Just want to know.
Regards
Karthik
 
the DSN is a default user, not mandatory, and it's only used to test the connection.

Look at this this way. If you setup a DSN with a "super user", and then someone else accesses that machine and uses the ODBC connection you have just setup, then they will be able to access your SQL server.


And just as an apart, if at all possible don't use DSN connections, as this means you have to install/configure them on each machine.
DSNless connections will give you less hassle.




Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top