connection string help

M

Mike

I'm trying to connect to a SQL db, I have the db setup as a DSN on my
machine, here is my connection string that i'm trying to use.

string dbConn = "Provider=sqloeldb;data source=Tech;Initial
Catalog=Tech;Integrate Security=SSPI;";

on my page I get this error;

[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access
denied.


and the error is pointing to

mbConn.Open() \\line

amd i missing something or doing something wrong?
 
C

Chris Jackson

Since you are using Windows authentication, this connection string will only
work for you if the account you are running under (your ID for WinForms,
ASPNET by default for WebForms - though you can use impersonation to
authenticate with a domain account) has permissions on that server.
 
M

Mike

i'm running everything locally the SQL 2000 server, and the ASP.NET
application.
How can i get this configured to run? what am i missing


Chris Jackson said:
Since you are using Windows authentication, this connection string will only
work for you if the account you are running under (your ID for WinForms,
ASPNET by default for WebForms - though you can use impersonation to
authenticate with a domain account) has permissions on that server.

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

Mike said:
I'm trying to connect to a SQL db, I have the db setup as a DSN on my
machine, here is my connection string that i'm trying to use.

string dbConn = "Provider=sqloeldb;data source=Tech;Initial
Catalog=Tech;Integrate Security=SSPI;";

on my page I get this error;

[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access
denied.


and the error is pointing to

mbConn.Open() \\line

amd i missing something or doing something wrong?
 
R

Rodrigo Meneses

well, you would have to associate a login to the aspnet user
Mike said:
i'm running everything locally the SQL 2000 server, and the ASP.NET
application.
How can i get this configured to run? what am i missing


Chris Jackson said:
Since you are using Windows authentication, this connection string will only
work for you if the account you are running under (your ID for WinForms,
ASPNET by default for WebForms - though you can use impersonation to
authenticate with a domain account) has permissions on that server.

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

Mike said:
I'm trying to connect to a SQL db, I have the db setup as a DSN on my
machine, here is my connection string that i'm trying to use.

string dbConn = "Provider=sqloeldb;data source=Tech;Initial
Catalog=Tech;Integrate Security=SSPI;";

on my page I get this error;

[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access
denied.


and the error is pointing to

mbConn.Open() \\line

amd i missing something or doing something wrong?
 
C

Cezary Nolewajka

You can do two things:
- allow the ASPNET account access to the appropriate databases with the needed access rigths to the database objects
- or use the user id and password (SQL authentication as opposed to windows authentication) and indicate it in the connection string:

string dbConn = "Provider=sqloeldb;data source=Tech;Initial
Catalog=Tech;user id=username;password=password";

Both options have their advantages and disadvantages. Consider:
- ASPNET gives you access to the database to all the ASP.Net applications
- "user id" gives you different id for the database for every ASP.Net application but stores the pass in clear text in the web.config, unless you perform some custom encryption

In .Net it's possible to change the ASPNET account (in the machine.config) and indicate the password and account (but still in clear text). In .Net 1.1 it's possible to encrypt those in registry. There were some posts on how to accomplish that.

It's possible as well to "impersonate" the ASP.Net account and make it run under different credentials than ASPNET account, which gives you the opportunity to use Windows authentication with ASP.Net/SQL but still passowrd are stored in clear text in web.config.

--
Cezary Nolewajka
mailto:[email protected]
remove all "no-sp-am-eh"s to reply



Mike said:
i'm running everything locally the SQL 2000 server, and the ASP.NET
application.
How can i get this configured to run? what am i missing


Chris Jackson said:
Since you are using Windows authentication, this connection string will only
work for you if the account you are running under (your ID for WinForms,
ASPNET by default for WebForms - though you can use impersonation to
authenticate with a domain account) has permissions on that server.

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

Mike said:
I'm trying to connect to a SQL db, I have the db setup as a DSN on my
machine, here is my connection string that i'm trying to use.

string dbConn = "Provider=sqloeldb;data source=Tech;Initial
Catalog=Tech;Integrate Security=SSPI;";

on my page I get this error;

[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access
denied.


and the error is pointing to

mbConn.Open() \\line

amd i missing something or doing something wrong?
 
R

Ruchi Gupta

Hey check the spellings, shouldn't it be

Provider=sqloLEdb

string dbConn = "Provider=sqloeldb;data source=Tech;Initial
Catalog=Tech;Integrate Security=SSPI;";
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top