Details: java.sql.SQLRecoverableException: IO Error: Connection reset - networking

I am trying to deploy the configuration and runtime using IBM Mobilfirst Server Configuration Tool for the server configuration, and I end up with a connection reset error. The error from the logfiles is
Cannot access database: ServiceName.
Details: java.sql.SQLRecoverableException: IO Error: Connection reset.
Kindly help in resolving this issue.
Which part is throwing the error? Is it DB side? Network Connectivity?

The ServerConfig Tool (SCT) creates the URL first by considering that the database name as SID. If the connection fails, it then connects using the database name as a service name.
I see that you are seeing the error - 'Cannot access database: ServiceName. Details: java.sql.SQLRecoverableException: IO Error'.
When SCT notices an unknown error while connecting it stops the connection process with the above error.
I would recommend you to run the ANT tasks for configuring MFP to get detailed logs on why configuration is failing.

Related

.NET Core API cannot connect to MS LocalDB

I am writing a .NET Core 2.1 web API using MS LocalDB. I can connect to my DB fine using SSMS and the server name (localdb)\MSSQLLocalDB with Windows Authentication.
The API fails to connect with the error:
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.
My connection string is:
Server=(localdb)\\MSSQLLocalDB;Database=Foo;Trusted_Connection=True;MultipleActiveResultSets=true
As a side note, I tried to check my LocalDB version with sqllocaldb v but got the following error:
Windows API call "RegGetValueW" returned error code: 0.
Is my LocalDB installation completely borked?
its kinda late but i am trying this for 2 days and finally found the answer.
When app is running on IIS
--> go to advance setting in the application pool, then on change "Process Model->Load Profile" to TRUE;
when app is running on Kestrel,
a. connection string "Data Source=(localdb)\mssqllocaldb"... etc
hope this help the others.

Why do I get "Unable to connect to SQL Server Database" when using aspnet_regsql in a server environment

I recently ran into an issue when using aspnet_regsql in our environment. Locally, I didn't have any problem using the following command line.
"%WinDir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regsql.exe" -S server\instance -E -ssadd -sstype p
However, when I move to our server environments, I get the following failure message.
An error has occurred. Details of the exception: 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: TCP Provider, error: 0 - The wait operation timed out.)
Unable to connect to SQL Server database.
I had a hunch that aspnet_regsql was using a different port than the default 1433. After using wireshark, I confirmed my suspicion and it was using 1434 which locally had no problem but since in a server environment, we need to explicitly request to open port, it was close by default.
The fix was simple enough which was to explicitly specify the port -S server\instance,1433

Azure website sometimes can't connect to SQL Azure database

I've been testing a website in Azure for about a month (Free trial), and now I've subscribed to pay-as-you-go. When I was on the free trial, I had absolutely no connectivity issues. Now I've deployed again to a fresh website created on the pay-as-you-go subscription with the same settings (scaling mode etc.) as the previous one. However, now when I navigate to my site, it sometimes fails to connect to my database:
Server Error in '/' Application.
A connection attempt failed because the connected party did not properly respond after
a period of time, or established connection failed because connected host has failed to
respond
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.ComponentModel.Win32Exception: A connection attempt failed
because the connected party did not properly respond after a period of time, or
established connection failed because connected host has failed to respond
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:
[Win32Exception (0x80004005): A connection attempt failed because the connected party
did not properly respond after a period of time, or established connection failed
because connected host has failed to respond]
[SqlException (0x80131904): 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: TCP Provider, error: 0 - A connection attempt
failed because the connected party did not properly respond after a period of time, or
established connection failed because connected host has failed to respond.)
I try to refresh the page and it connects. After a few minutes, when I try again, I sometimes get the same error again, but sometimes not. I never had a single connectivity issue in the free trial mode. Why does it happend and how can I prevent this problem?
Transient errors are expected in a cloud environment. Let's say that a database call fails, if you retry a few milliseconds later, that same call would now work. To shield you from these errors, you need to implement a retry logic. If you use Entity Framework 6, you're in luck since it's baked in: http://msdn.microsoft.com/en-US/data/dn456835
Here's a quick video on how to implement this: http://www.azurerocks.com/0_oaw-merMw
You can also use the Enterprise Library Transient Fault Handling Application Block: http://msdn.microsoft.com/en-us/library/hh680934(v=pandp.50).aspx

SQL Error login with ASP.NET

Hi I am facing a problem with running exercise file of asp.net Quiz engine when try to make login as admin this message show up in the browser
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: 26 - Error Locating Server/Instance Specified)
The first place I would look would would be My Computer > Manage and then click on Services. Scroll down to SQL Server, and verify that the service is started (I noticed on my development environments that occasionally my service will not start event though it is set to automatically start. Also, are you running a default or named instance of SQL Server? If your service is started, and you think your connection string is correct, could you include your connection string (obviously omit any username/password credentials) so that I can see what that looks like?

MSDTC is only working in one direction

I'm trying to use TransactionScope for unit tests and I keep getting errors on our build server. After following several helpful SO answers and blogs, I installed DTCPing and ran it on both server1 & server2. When I run it in the reverse order it seems to connect in one direction and fail in the other:
++++++++++++Validating Remote Computer Name++++++++++++
Please refer to following log file for details:
D:\KPAHQDEV043372.log
Invoking RPC method on teamcity
RPC test is successful
++++++++++++RPC test completed+++++++++++++++
++++++++++++Start DTC Binding Test +++++++++++++
Trying Bind to teamcity
Binding call to teamcity Failed
Session Down
But when I run it in the intended direction it just fails the RPC
++++++++++++Validating Remote Computer Name++++++++++++
Please refer to following log file for details:
C:\TEAMCITY3024.log
Invoking RPC method on kpahqdev04
Problem:fail to invoke remote RPC method
Error(0x6BA) at dtcping.cpp #303
-->RPC pinging exception
-->1722(The RPC server is unavailable.)
RPC test failed
I found some helpful info here but now I'm just stuck. Any ideas?
You need to add Distributed Transaction Coordinator service as an exception in firewall.
Also make sure RPC (port 135) is enabled and added as en exception in firewall.
Also you can check if firewall is the culprit by turning off firewall and re-running the DTCPing.

Resources