Re: OLEDB database connection from ASP.NET

From: Steve C. Orr [MVP, MCSD] (Steve_at_Orr.net)
Date: 04/16/04


Date: Fri, 16 Apr 2004 14:12:29 -0700

ASP.NET applications run under the user account ASPNET by default.
I'd say the likely problem is that this user account does not have
permissions to your database.
Either give it permissions or user impersonation to run ASP.NET under a
different user account that has the necessary privileges.
Here's more info:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconaspnetimpersonation.asp

-- 
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Louise Hadley" <louise.hadley@hadleybain.com> wrote in message
news:28d72892.0404161234.6d00cacc@posting.google.com...
> I can connect to a Sybase database from a WindowsApp project without
> any problems, but when I use the same code to connect from an aspx.vb
> file I get an OLEDB exception "Database server not found".
>
> Code is:
>
> Imports System.Data.OleDb
>
> Public Class WebForm1
>     Inherits System.Web.UI.Page
>
>
>     Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
>
>             Dim strConn As String
>             Dim objDBConn As OleDbConnection
>             Dim objCommand As OleDbCommand
>
>             strConn = "provider=ASAProv;data source=systemsupport"
>
>             objDBConn = New OleDbConnection(strConn)
>             objCommand = New OleDbCommand("spEventLog_Add_2",
> objDBConn)
>             objCommand.CommandType = CommandType.StoredProcedure
>
>          objDBConn.Open()
>           .................
>
>
> If I paste this code into WindowsApp form it runs fine!
>
> Is there something inherently different in the way I should connect to
> the database in ASP.
>
> I have the same problem when I call method functions in components
> from the ASP that simply return arraylists - they work fine when
> called from Windows apps but not when called from the ASP.
>
> Tx,
> Louise


Relevant Pages

  • Re: Change User ID - Possible?
    ... Never directly change SharePoint data in the database. ... The Only way you can do is to replace the user account i.e. delete the old user account and add a new user account, but before you delete the old account you have to find out the permissions of the old account and apply the same permissions to the new account, this can be automated through code. ...
    (microsoft.public.sharepoint.windowsservices)
  • Re: Question about strong-name dlls
    ... The user doesn't have "asp" in its name. ... user account by seeing what user account the process is running under. ... user account will need the proper permissions. ... >> Sometimes the elephant eats you. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Error 21002: [ SQL-DMO] User "xxxxx" already exists.
    ... What version and service pack of SQL Server are you running? ... No restoration of database was performed. ... I do not see that user account as orphaned. ... > saved with necessary permissions for the selected database. ...
    (microsoft.public.sqlserver.security)
  • Re: Log In
    ... knowledge about security for database. ... I want to set user account and ... accomplishing it? ... I have my database i want to share to some of my colleagues for updating. ...
    (microsoft.public.access.security)
  • RE: No search results from non-portal content
    ... Central Administration and under Server Configuration, ... Have the customer add a user account with Local Administrator ... Roles Tab check off Systems Administrator, Security Administrator, Database ...
    (microsoft.public.sharepoint.portalserver)

Quantcast