DB2 Exception - There are no context policies - db2

I am trying to connect to a Windows based DB2 server using the 11.5 ADO.NET connector. This works fine (it's some unit tests) on all systems except my home computer.
On my home computer I get the following exception:
{"ERROR [58005] [IBM][DB2.NET] SQL0902 An unexpected exception has occurred in Process: 69336 Thread 11 AppDomain: Name:Tests: TestKailua
There are no context policies.
Function: AESEncryptADONET (Encryption Info)
allStack: at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Environment.get_StackTrace()
at IBM.Data.DB2.DB2ConnPool.HandleUnknownErrors(String strFncMsg, Exception exception, Boolean bThrow)\r\n at IBM.Data.DB2.DB2ConnPool.EncryptString(String value)
at IBM.Data.DB2.DB2ConnPool.ReplaceConnectionStringParms(DB2Connection connection, String szValue, DB2ConnSettings& pSettings, DB2ConnSettingsInternal& pSettingsInternal, Boolean bAttach, Boolean pushDownStrAppended)
at IBM.Data.DB2.DB2Connection.set_ConnectionString(String value)
And the inner exception is:
AESEncryptADONET - Encryption - no error information available
at IBM.Data.DB2.DB2ConnPool.EncryptString(String value)
What do I not have configured?

Related

FirebirdSql Data Client I/O error during "CreateFile (open)" operation for file

One of our clients is getting this error very randomly. Once or twice a week. It has only been happening for the last month or so.
Error message:
I/O error during "CreateFile (open)" operation for file "ttt"
Error while trying to open file
Stack trace:
at FirebirdSql.Data.FirebirdClient.FbConnectionInternal.Connect()
at FirebirdSql.Data.FirebirdClient.FbConnectionPoolManager.Pool.CreateNewConnection(FbConnectionString connectionString, FbConnection owner)
at FirebirdSql.Data.FirebirdClient.FbConnectionPoolManager.Pool.CreateNewConnectionIfPossibleImpl(FbConnectionString connectionString, FbConnection owner)
at FirebirdSql.Data.FirebirdClient.FbConnectionPoolManager.Pool.GetConnection(FbConnection owner)
at FirebirdSql.Data.FirebirdClient.FbConnectionPoolManager.Get(FbConnectionString connectionString, FbConnection owner)
at FirebirdSql.Data.FirebirdClient.FbConnection.Open()
at TTT.DALFirebird.FbSocket.ExecuteScalar(CommandType commandType, String commandText, String connectionString, FbParameter[] parameters)
at TTT.LibGlobal.Data.FirebirdHelper.TestConnection(String connectionString)
------
Error message:
I/O error during "CreateFile (open)" operation for file "ttt"
Error while trying to open file
Stack trace:
at FirebirdSql.Data.Client.Managed.Version10.GdsDatabase.ProcessResponse(IResponse response)
at FirebirdSql.Data.Client.Managed.Version10.GdsDatabase.ReadResponse()
at FirebirdSql.Data.Client.Managed.Version10.GdsDatabase.ReadGenericResponse()
at FirebirdSql.Data.Client.Managed.Version10.GdsDatabase.Attach(DatabaseParameterBuffer dpb, String dataSource, Int32 port, String database)
at FirebirdSql.Data.FirebirdClient.FbConnectionInternal.Connect()
The database is hosted on a dedicated PC with Windows 8.1.
Firebird version: 3.0.7.33374 (x64)
Firebird Sql Data Client version: 4.6.1.0
I checked the security settings for the database file and gave full control for the system and users. Not sure what else it could be as the 3050 port is open and there's no issue with users connecting 99% of the time. Is a particular test their I.T. can run to diagnose?
The connection string for the desktop application is:
dialect=3;initial catalog=<Database Alias>;data source=<IP ADDRESS>;user id=<User>;password=<Password>;character set=ISO8859_1;pooling=True;connection lifetime=30;server type=Default;port number=3050
Please let me know if you require any further information.
They are trying to connect to database "ttt". This database (or alias) is not found so they get the error. As the developer of the application you should know what "TTT" object in the call stack may be and how connection string is formed.

Azure Functions v3, Dotnet Core v3.1 EF core /EF Core SQL 3.1.x No Errors no Data from SQL in Kubernetes

using this image mcr.microsoft.com/azure-functions/dotnet:3.0. Running on baremetal kubernetes or local docker I get no errors but also no data from SQL Server. I am using the RabbitMq trigger to start the function on received message. The function is async and I use FunctionsStart in my startup.cs. I have confirmed the environment variable is set and correct at runtime. The context is not used directly in the function but is use by another IService that I inject.
Note - The code runs just fine in the debug emulator, connection and data return without issues. Also runs just fine with I remove EF and the MyDbContext.
builder.Services
.AddDbContext<MyDbContext>(options =>
options.UseSqlServer(Environment.GetEnvironmentVariable("MY_DB")))
Note sure if this warning is related to the issue.
warn: Microsoft.Azure.WebJobs.Script.ChangeAnalysis.ChangeAnalysisService[0]
Breaking change analysis operation failed
System.NotSupportedException: The invoked member is not supported in a dynamic assembly.
at System.Reflection.Emit.InternalAssemblyBuilder.get_CodeBase()
at Microsoft.Azure.WebJobs.Script.ChangeAnalysis.ChangeAnalysisService.LogBreakingChangeReport(CancellationToken cancellationToken) in /src/azure-functions-host/src/WebJobs.Script.WebHost/BreakingChangeAnalysis/ChangeAnalysisService.cs:line 140
at Microsoft.Azure.WebJobs.Script.ChangeAnalysis.ChangeAnalysisService.TryLogBreakingChangeReportAsync(CancellationToken cancellationToken) in /src/azure-functions-host/src/WebJobs.Script.WebHost/BreakingChangeAnalysis/ChangeAnalysisService.cs:line 103
[14:39:30 WRN] Breaking change analysis operation failed
System.NotSupportedException: The invoked member is not supported in a dynamic assembly.
at System.Reflection.Emit.InternalAssemblyBuilder.get_CodeBase()
at Microsoft.Azure.WebJobs.Script.ChangeAnalysis.ChangeAnalysisService.LogBreakingChangeReport(CancellationToken cancellationToken) in /src/azure-functions-host/src/WebJobs.Script.WebHost/BreakingChangeAnalysis/ChangeAnalysisService.cs:line 140
at Microsoft.Azure.WebJobs.Script.ChangeAnalysis.ChangeAnalysisService.TryLogBreakingChangeReportAsync(CancellationToken cancellationToken) in /src/azure-functions-host/src/WebJobs.Script.WebHost/BreakingChangeAnalysis/ChangeAnalysisService.cs:line 103

Hang in System.Data.Entity.DbSet.Add()

I am following the Create an OData v4 Endpoint Using ASP.NET Web API 2.2 sample, and the Post() method implementation looks like this:
public async Task<IHttpActionResult> Post(Product product)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
db.Products.Add(product);
await db.SaveChangesAsync();
return Created(product);
}
However, when a Post request is received, Products.Add() hangs and never returns. No exception is thrown.
Under WinDBG I can see the following callstack:
System.Threading.Thread.Sleep
System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist
System.Data.SqlClient.SqlInternalConnectionTds..ctor
System.Data.SqlClient.SqlConnectionFactory.CreateConnection
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection
System.Data.ProviderBase.DbConnectionPool.CreateObject
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest
System.Data.ProviderBase.DbConnectionPool.TryGetConnection
System.Data.ProviderBase.DbConnectionPool.TryGetConnection
System.Data.ProviderBase.DbConnectionFactory.TryGetConnection
System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal
System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection
System.Data.SqlClient.SqlConnection.TryOpenInner
System.Runtime.InteropServices.SafeHandle.Dispose
System.Data.SqlClient.SqlConnection.TryOpen
System.Data.SqlClient.SqlConnection.Open
System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open
System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute
System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute
System.Data.Entity.SqlServer.SqlProviderServices.UsingConnection
System.Data.Entity.SqlServer.SqlProviderServices.UsingMasterConnection
System.Data.Entity.SqlServer.SqlProviderServices.GetDbProviderManifestToken
System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken
System.Data.Entity.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked
System.Data.Entity.Infrastructure.DefaultManifestTokenResolver.ResolveManifestToken
System.Data.Entity.Utilities.DbConnectionExtensions.GetProviderInfo
System.Data.Entity.DbModelBuilder.Build
System.Data.Entity.Internal.LazyInternalContext.CreateModel
System.Data.Entity.Internal.LazyInternalContext.InitializeContext
System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType
System.Data.Entity.DbSet.Add
ProductService.Controllers.ProductsController.Post
I am using EntityFramework 6.1.3.
If the Add() method is the one creating the connection with the database, should it be an *Async() method?
Update:
After porting the code from ASP.NET to Console Application, I caught the following exception:
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in EntityFramework.dll
Additional information: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.)
The problem is that the tutorial connection string is not valid anymore for Visual Studio 2015; Data Source=(localdb)\v11.0 needs to be replaced with Data Source=(localdb)\mssqllocaldb.
I.e.:
<add
name="ProductsContext"
connectionString="Data Source=(localdb)\mssqllocaldb;
Initial Catalog=ProductsContext; Integrated Security=True;
MultipleActiveResultSets=True;
AttachDbFilename=|DataDirectory|ProductsContext.mdf"
providerName="System.Data.SqlClient" />

Entity Framework, and connection strings

I'm trying to deploy my .net website to a shared hosting server. I'm getting the following error when entity framework tries to connect to the database:
Server Error in '/' Application.
Login failed for user 'PHX3\Iusr_9086819'. 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 'PHX3\Iusr_9086819'.
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 (0x80131904): Login failed for user
'PHX3\Iusr_9086819'.]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
exception, Boolean breakConnection) +5061898
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +234
Here is my connection string, with sensitive data removed:
<add name="CoreEntities"
connectionString="
metadata=res://*/CoreModel.csdl|res://*/CoreModel.ssdl|res://*/CoreModel.msl;
provider=System.Data.SqlClient;
provider connection string='
Data Source=*****.db.*****.hostedresource.com;
Initial Catalog=kshoultz;
integrated security=True;
multipleactiveresultsets=True;
App=EntityFramework;
User ID=*****;
Password=*****;
Database=*****;
'"
providerName="System.Data.EntityClient" />
I think integrated security should be false - that means not to use a user id and password. Initial catalog is the name of the database - did they tell you the database was named kshoultz? (Could be, I don't know any different, but if you created a database and chose a name, that's the name you want to use). Has the password got any characters that aren't letters/numbers? You have to encode them, for example is your password is Love&Peace you have to say Love&Peace
Have you asked GoDaddy support?

Crystal report 9.2, incorrect log on parameters

Background;
The Web application is developed for .Net framework 4.0. It has crystal report 9.2 integration. Application runs on Integrated Windows Authentication. The crystal reports are working fine when we execute, from solution running under Visual Studio 2010. When the same report are deployed to server (Web Server- OS: Windows Server 2003-SP2-32bit. DB Server- OS: Windows Server 2003-32bit) following error occurs, incorrect log on parameters. Crystal Report Runtime Engine for .net framework 4.0 has been installed in web server. Reports are configured to work on ODBC, System DSN with SQL Server driver. This drivers runs on SQL Server user account which has permission on database. There are no logon parameters passed from application. Just to verify, solution of passing the logon parameters from application is also tried, but the problem is not resolved.
Note: To resolve full access has been provided to IIS_WPG account on folder: C:\Windows\Temp, C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files and web application.
Server Error in '/XXXX' Application.
________________________________________
Error in File E:\WebApps\XXXX\Reports\CompanyStandard.rpt:
Unable to connect: incorrect log on parameters.
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: CrystalDecisions.CrystalReports.Engine.LogOnException: Error in File E:\WebApps\XXXX\Reports\CompanyStandard.rpt:
Unable to connect: incorrect log on parameters.
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:
[LogOnException: Error in File E:\WebApps\XXXX\Reports\CompanyStandard.rpt:
Unable to connect: incorrect log on parameters.]
. N(String -, EngineExceptionErrorID 0) +582
. I(Int16 !, Int32 ") +277
CrystalDecisions.CrystalReports.Engine.FormatEngine.GetPage(PageRequestContext reqContext) +429
CrystalDecisions.ReportSource.LocalReportSourceBase.GetPage(PageRequestContext pageReqContext) +172
CrystalDecisions.Web.ReportAgent.|(Boolean Z) +223
CrystalDecisions.Web.CrystalReportViewer.OnPreRender(EventArgs e) +165
System.Web.UI.Control.PreRenderRecursiveInternal() +103
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496
You need to change the profile IIS is running under to a domain account or change your web.config file to impersonate the user. Otherwise you will need to apply logoninfo for the report.