cancel
Showing results for 
Search instead for 
Did you mean: 

DotNet Portal Development Kit - Problem connecting to SQL Server

Former Member
0 Kudos

Any help would be appreciated. I'm trying to create a portal application with the dotnet pdk. I need to connect to a SQL Server database.

When I run the application in the portal I'm getting the following error:

Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.

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: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SqlException: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.]

System.Data.SqlClient.ConnectionPool.CreateConnection() +402

System.Data.SqlClient.ConnectionPool.UserCreateRequest() +147

System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) +391

System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +311

System.Data.SqlClient.SqlConnection.Open() +384

System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState) +44

System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +304

System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +77

System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +38

PortalApplication2.PortalComponent1.Page_Load(Object sender, EventArgs e)

System.Web.UI.Control.OnLoad(EventArgs e) +55

SAP.Portal.Web.UI.PortalComponent.OnLoad(EventArgs e) +17

System.Web.UI.Control.LoadRecursive() +27

System.Web.UI.Control.LoadRecursive() +90

System.Web.UI.Control.LoadRecursive() +90

System.Web.UI.Page.ProcessRequestMain() +750

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

All,

Similarly, I'm using a credentials-provided method (instead of Windows Authentication) and I'm getting this:

-


SQL Server does not exist or access denied.

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: SQL Server does not exist or access denied.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SqlException: SQL Server does not exist or access denied.]

System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) +483

System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +311

System.Data.SqlClient.SqlConnection.Open() +383

System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState) +44

System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +304

System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +77

System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +38

JobsPortalApp.JobIView.btnSubmit_Action(Object sender, ActionEventArgs e) in d:\projects\optiant\jobsportalapp\jobiview.ascx.cs:137

SAP.Web.UI.Controls.AbstractButton.OnAction(ActionEventArgs e) +88

SAP.Web.UI.Controls.AbstractButton.RaisePostBackEvent(String eventArgument) +121

System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18

System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +138

System.Web.UI.Page.ProcessRequestMain() +1292

-


My ConnectionString is as follows:

workstation id=APOLLO_2;packet size=4096;user id=sa;data source=APOLLO_2;persist security info=True;initial catalog=SAPExperiment;password=password

(that's right! sa/password! :P)

APOLLO_2 is my local machine that hosts a SQL Server 2000 instance. I can compile, deploy, run and see the iView. The application I'm writing is Tutorial 2 from the Developer's "manual", with one caveat: Instead of using Form_Load() to do all the dataset filling, and binding, I'm using an SAP Button. It was to my understanding that there wasn't anything else special to do considering the shortness of Tutorial 2... Any ideas?

Former Member
0 Kudos

Hi Joseph,

Some simple suggestions:

Try connecting to this same server from the server explorer (with the same settings), see if that works. If not - you have a problem with these settings. If yes - drag the created connection to your designer and use that to get the connection string.

Also try using "localhost" or "." instead of machine name.

Regards,

Ofer

Former Member
0 Kudos

Ofer,

PortalServerMachine: SAPLAB1 (SAP software, no SQL Server)

MyDevelopmentMachine: APOLLO_2 (VisualStudio2K3, .NET 1.1, SQL Server 2000)

Using 'localhost' or '.' may not work in this situation because once I deploy the iView to the Portal, 'localhost' really means 'SAPLAB1' and not 'APOLLO_2'. Is there some setting on the SAP Portal level that I might need to take a look at and configure? Or do some of you think that this is a network-infrastructure-level issue (i.e. DNS Server not resolving 'APOLLO_2', etc...)?

Former Member
0 Kudos

I installed the Enterprise Manager tools on the SAP Portal and am not able to connect from there to APOLLO_2 leading me to believe that my issue that I reported is not SAP-related. I'll investigate further and report what I find...

Former Member
0 Kudos

Hahaha!! To the .NET PDK developers out there working with SQL Server: Configure your firewalls to allow other computers to connect to your SQL Server instances!

(I just removed mine to quickly test the idea... :P)

reiner_hille-doering
Active Contributor
0 Kudos

It seems that you are using a connection string that doesn't contain a username and a password - instead relies on Windows Authentication.

This must be configured in SQL server Enterprise Manager:

Got to "Security -> Logins" -> "New Login...". Add the Windows User that is used to run the PDK Runtime Service. I don't know in the moment which is it is - maybe you can also configure this.

Alternatively you use a connection string with username and password. Note that you may need to enable this so-called "SQL Server Authentication" in SQL Enterprise Manager.

former_member182374
Active Contributor
0 Kudos

Hi Julie,

Can you post your connection string?

Are you able to connect to the DB by using Server Explorer?

Omri

Former Member
0 Kudos

My connection string is:

workstation id=MyComputerName;packet size=4096;integrated security=SSPI;data source=MyServerName;persist security info=False;initial catalog=ERPKPI

I've also tried persist security info = True

but that didn't work either.

I'm trying to use the Network Security to retrieve the data, instead of a specific name and password. In Server Explorer, I can see the database and everything it contains.