Question about connection strings...

266 Views | 5 Replies | Last: 9 yr ago by datrixstunna
ABATTBQ11
How long do you want to ignore this user?
AG
First off, I am not an IT guy or intimately familiar with dealing with databases. If any of this sounds dumb, that 's why.

Currently, I have an Excel macro using a connection string to get records from a database on one of our servers. The syntax is:
quote:
Provider=sqloledb;Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;
I would like to use something like:
quote:
Provider=sqloledb;Data Source=myServerAddress;Initial Catalog=myDataBase;
User Id=myUsername;Password=myPassword;
The first connection string works, but when I try the second, it says that logon failed. As I understand it, SSPI just uses the current Windows credentials, so why can't I just enter Windows credentials (my idea is to have an account for this macro to use since lots of people without server access will need to use it)?
pnut02
How long do you want to ignore this user?
AG
I'm probably not much help, but did you put in the domain name with your Username? ie domain\username
datrixstunna
How long do you want to ignore this user?
AG
You cant use the first method with another username. You may have to use impersonation to achieve that. To use the second method, I would create a generic server level (versus a domain) username and password on the database and pass those through the connection string.
ABATTBQ11
How long do you want to ignore this user?
AG
I did use the domain name. No dice.

Datrix, if I understand you right, that's what I'm trying to do. The first string is what I have that actually works (I needed it to write everything else), but I want to change it to something like the second string and use a generic account for people to log on with. Just so I'm sure with where you're going , are you saying to create the generic account on the server itself instead of the domain and pass through those credentials?
datrixstunna
How long do you want to ignore this user?
AG
quote:
Just so I'm sure with where you're going , are you saying to create the generic account on the server itself instead of the domain and pass through those credentials?
Correct. Lets assume this is a SQL Server database. Just create a SQL Server username on the server then give it access to the database and pass those credentials.
ABATTBQ11
How long do you want to ignore this user?
AG
That's exactly what I needed to know. Thanks!
datrixstunna
How long do you want to ignore this user?
AG
NP
Refresh
Page 1 of 1
 
×
subscribe Verify your student status
See Subscription Benefits
Trial only available to users who have never subscribed or participated in a previous trial.