Question

I am getting 'unspecified error while opening oledb Connection' Below are the stack trace details. Please help me to find a solution.

[OleDbException (0x80004005): Unspecified error]
   System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) +968957
   System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) +86
   System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) +29
   System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +4863020
   System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117
   System.Data.OleDb.OleDbConnection.Open() +40
   ASP.aboutus_aspx.Page_Load(Object sender, EventArgs e) in C:\Sites\Single17\watchbroker\webroot\aboutus.aspx:22
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
Was it helpful?

Solution

System.Data.OleDb.OleDbException: Unspecified error

This error mostly belongs to permission error, for this error we have mutiple solutions as per situation

  1. Put the impersonate=false in web.config file.

  2. If you want to put the impersonate = true in that case you need to provide the read/write permission to impersonate user on "C:\Documents and Settings\server name\ASPNET" folder or through process monitor utility you can check which file don't have sufficient permission.

  3. If you have windows server 2008 then you will not found the ASPNET folder and still want impersonate=true then you need to change the configuration in IIS 7.5/7.0.

Go to IIS -> select your application pool -> Advanced Setting -> Process Model ->Identity=ApplicationPoolIdentity

Go to IIS -> select your application pool -> Advanced Setting -> Load User Profile = False

OTHER TIPS

You're providing little detail, but a Google for the error code and oledbconnection turned up this, which has this answer:

solved. this has to do with impersonation. in web.config, i set impersonate back to false and it works. i read in another article on this forum that because when .net reads an excel file, it creats a temp folder to store the data, and that temp folder can only be access by the ASPNET account. so if you impersonate as another user on the computer / network and tried to use ASPNET to read the data in the excel file, you will not be able to.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top