System.Data.SqlClient.SqlException: Cannot open database

Stimulsoft Reports.NET discussion
Post Reply
scottm5443
Posts: 4
Joined: Wed Dec 09, 2015 11:51 pm

System.Data.SqlClient.SqlException: Cannot open database

Post by scottm5443 »

I hope some one can help me. I have a report server running that was built quite some time back and that team is no longer around. We are building a new domain and built some new MSsql servers in the new IP space. The IIS server that was serving the reports is still on the old domain, and old IP space. I have not used the stimulsoft software before, and didn't find any hits on the search close to me issue. Logging onto the reports web page, and trying to run any report, I get the same basic error message as below. Any help for a complete NOOB on this?

We are running Windows 2003r2 and Stimulsoft Reports.net version 2009.3.600.

And yes I know it old and no support for 2003 etc. That is why we are moving everything over step by step to the new domain and new servers.


Server Error in '/ManagementConsole' Application.
--------------------------------------------------------------------------------

Cannot open database "ManagementConsole" requested by the login. The login failed.
Login failed for user 'MC-MagazineReport'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Cannot open database "ManagementConsole" requested by the login. The login failed.
Login failed for user 'MC-MagazineReport'.

Source Error:


Line 84: report.CompiledReport.DataSources["rptMagLeadList_RK"].Parameters["@EndDate"].ParameterValue = EndDateTime;
Line 85:
Line 86: report.Render(true);
Line 87: StiWebViewer1.Report = report;
Line 88: StiWebViewer1.Visible = true;


Source File: f:\Inetpub\wwwroot\ManagementConsole\Reports\Miscellaneous Report\RealTimeLeadListReport_Mag.aspx.cs Line: 86

Stack Trace:


[SqlException (0x80131904): Cannot open database "ManagementConsole" requested by the login. The login failed.
Login failed for user 'MC-MagazineReport'.]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4846903
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392
System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +35
System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +144
System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +342
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +221
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +189
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +185
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +31
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +433
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +499
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +65
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117
System.Data.SqlClient.SqlConnection.Open() +122
Stimulsoft.Report.Dictionary.StiSqlAdapterService.OpenConnection(IDbConnection connection, StiData data, StiDictionary dictionary) +1264
Stimulsoft.Report.Dictionary.StiSqlAdapterService.ConnectDataSourceToData(StiDictionary dictionary, StiDataSource dataSource, Boolean loadData) +1008
Stimulsoft.Report.Dictionary.StiDataSource.Connect(StiDataCollection datas, Boolean loadData) +96
Stimulsoft.Report.Dictionary.StiDataSourcesCollection.Connect(StiDataCollection datas, Boolean loadData) +154
Stimulsoft.Report.Dictionary.StiDictionary.Connect(Boolean loadData) +130
Stimulsoft.Report.Engine.StiRenderProviderV2.ConnectToData(StiReport report) +85
Stimulsoft.Report.Engine.StiRenderProviderV2.Render(StiReport report, StiRenderState state) +1342
Stimulsoft.Report.Engine.StiReportV2Builder.RenderSingleReport(StiReport masterReport, StiRenderState renderState) +796
Stimulsoft.Report.StiReport.RenderReport(StiRenderState renderState) +136
Stimulsoft.Report.StiReport.Render(StiRenderState renderState, StiGuiMode guiMode) +777
Stimulsoft.Report.StiReport.Render(Boolean showProgress) +53
Reports_Miscellaneous_Report_RealTimeLeadListReport.RunRealTimeLeadListReport() in f:\Inetpub\wwwroot\ManagementConsole\Reports\Miscellaneous Report\RealTimeLeadListReport_Mag.aspx.cs:86
Reports_Miscellaneous_Report_RealTimeLeadListReport.btnSearch_Click(Object sender, EventArgs e) in f:\Inetpub\wwwroot\ManagementConsole\Reports\Miscellaneous Report\RealTimeLeadListReport_Mag.aspx.cs:95
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: System.Data.SqlClient.SqlException: Cannot open database

Post by HighAley »

Hello.

There is no access to the database.
The error occurs at connection time.
Please, check connection string in the report connection.
You could get it using next code:

Code: Select all

String connectionString = ((StiSqlDatabase)report.Dictionary.Databases["Connection"]).ConnectionString;
Thank you.
scottm5443
Posts: 4
Joined: Wed Dec 09, 2015 11:51 pm

Re: System.Data.SqlClient.SqlException: Cannot open database

Post by scottm5443 »

Thank you, but I'm a complete new user, where would I put in that code?
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: System.Data.SqlClient.SqlException: Cannot open database

Post by Alex K. »

Hello,

After load report before rendering.

Thank you.
scottm5443
Posts: 4
Joined: Wed Dec 09, 2015 11:51 pm

Re: System.Data.SqlClient.SqlException: Cannot open database

Post by scottm5443 »

I can't get that to work. How does one see the database connection on a report? Looking at my server, I don't see the report even trying to hit it. So I think I need to update the SQL server the report is trying to pull data from.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: System.Data.SqlClient.SqlException: Cannot open database

Post by Alex K. »

Hello,

There is no access to the database. Please check that you use correct connection string in your report.
As a way, you can try to set the connection string for your report:
((StiSqlDatabase)report.Dictionary.Databases["ConnectionNameInYourReport"]).ConnectionString = "";

Thank you.
scottm5443
Posts: 4
Joined: Wed Dec 09, 2015 11:51 pm

Re: System.Data.SqlClient.SqlException: Cannot open database

Post by scottm5443 »

There is no way to see the database the report is trying to pull data from?
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: System.Data.SqlClient.SqlException: Cannot open database

Post by Alex K. »

Hello,

Sorry, maybe we did not exactly understand your question. Could you explain your issue in more details?
You can check the connection string after load report:

Code: Select all

report.Load();
// Check the connection string in the report
string connectionString = ((StiSqlDatabase)report.Dictionary.Databases["Northwind"]).ConnectionString;
Also you can run designer and check your connection string.

Thank you.
Post Reply