We have swapped SQL existing IP of working DB server for new server and after that SQL reports when executed from web application throws error. Application work fine for CRUD operation; its reports fails.
But as we swap back IP to old server it works fine.
NOTE: We made windows firewall off.
Error log - Report View System Error for Report "ReportName" :- System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: 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 XXXX:80 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) --- End of inner exception stack trace --- at Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.GetSecureMethods() at Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.IsSecureMethod(String methodname) at Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.SetConnectionSSLForMethod(String methodname) at Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.ProxyMethodInvocation.Execute[TReturn](RSExecutionConnection connection, ProxyMethod1 initialMethod, ProxyMethod1 retryMethod)
Related
We recently split our single EC2 (t2.small) instance which was running (IIS and MySQL) into 2 - (t2.small) instances. We moved all the IIS logic to the new instance and updated the WebConfigs to connect to the old machine which is running MySQL. After firing everything up we noticed very random/sporadic exceptions from MySQL related to connection issues. Overall our connection to the DB works but it seems to drop under certain cases. We tried tweaking timeouts on both IIS and MySQL side but didn't help. The last thing we tried was instead of using the private (Internal) IP for the connection to the MySQL Db we used the public (Elastic IP). With the public IP everything works perfect and we do not get any connection exceptions
Does anyone have any insight into why using the private IP between the servers is inconsistent, but the public IP works very reliably?
MySQL Exception:
*MySql.Data.MySqlClient.MySqlException: Fatal error encountered during command execution. ---> MySql.Data.MySqlClient.MySqlException: Fatal error encountered attempting to read the resultset. ---> MySql.Data.MySqlClient.MySqlException: Reading from the stream has failed. ---> System.IO.IOException: Unable to read data from the transport connection: 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. ---> System.Net.Sockets.SocketException: 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 at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) --- End of inner exception stack trace --- at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) at MySql.Data.MySqlClient.TimedStream.Read(Byte[] buffer, Int32 offset, Int32 count) at MySql.Data.MySqlClient.MySqlStream.ReadFully(Stream stream, Byte[] buffer, Int32 offset, Int32 count) at MySql.Data.MySqlClient.MySqlStream.LoadPacket()*
*System.Data.Entity.Core.EntityException: The underlying provider failed on Open. ---> MySql.Data.MySqlClient.MySqlException: Reading from the stream has failed. ---> System.IO.IOException: Unable to read data from the transport connection: 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. ---> System.Net.Sockets.SocketException: 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 at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)*
We ended up solving this issue by following this guide for windows. Setting the below TCP settings in the Registry.
https://docs.aws.amazon.com/redshift/latest/mgmt/connecting-firewall-guidance.html
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\:
KeepAliveTime: 30000
KeepAliveInterval: 1000
TcpMaxDataRetransmissions: 10
when running
dotnet ef database update --startup-project ../webapi/webapi.WebAPI.csproj
on my MAC 10.13.5
I get this error -
System.Data.SqlClient.SqlException (0x80131904): A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 35 - An internal exception was caught) ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception. ---> System.EntryPointNotFoundException: Unable to find an entry point named 'AppleCryptoNative_SslCreateContext' in shared library 'System.Security.Cryptography.Native.Apple'.
at Interop.AppleCrypto.SslCreateContext(Int32 isServer)
at System.Net.SafeDeleteSslContext.CreateSslContext(SafeFreeSslCredentials credential, Boolean isServer)
at System.Net.SafeDeleteSslContext..ctor(SafeFreeSslCredentials credential, SslAuthenticationOptions sslAuthenticationOptions)
at System.Net.Security.SslStreamPal.HandshakeInternal(SafeFreeCredentials credential, SafeDeleteContext& context, SecurityBuffer inputBuffer, SecurityBuffer outputBuffer, SslAuthenticationOptions sslAuthenticationOptions)
--- End of inner exception stack trace ---
...
A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 35 - An internal exception was caught)
I originally thought this was my local docker database was not available but when connecting to new database instance it still occurs, this was working yesterday.
Whilst typing this I came across this, but thought would just add the answer as someone on a MAC EF Core install may miss that also when searching -
A connection was successfully established with the server, but then an error occurred during the pre-login handshake
Cleaning my project (I personally deleted all the folders) and rebuilding, sorted it!
I have been facing a simple sql connection error, and i m tired of fixing it. I installed sql server 2014 and then sql server 2017, add rules to firewall and even turned off the firewall. services restarted multiple times.
Went to configuration manager, enabled everything, added all the jar required, done clean and build, done all searches on this issue in google, still that same issue comes in again and again. System used are
- Windows 10.
- Sql server management studio 2017.
- Netbean 8.1
code :-
import java.sql.*;
public class DbConnect {
public static void main(String[] args) throws SQLException,ClassNotFoundException {
String url = "jdbc:sqlserver://localhost:1433;databaseName=productlist;user=db2017;password=db2017";
//commented :-String url = "jdbc:sqlserver://DESKTOP-7CI6DU0\\NIT2017:1433;databaseName=productlist;user=db2017;password=db2017";
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
Connection conn = DriverManager.getConnection(url);
System.out.println("test");
Statement sta = conn.createStatement();
String Sql = "select * from productlist";
ResultSet rs = sta.executeQuery(Sql);
while (rs.next()) {
System.out.println(rs.getString("CatName"));
} } }
Below is exception error comes again again, after so much troubleshooting.
Exception in thread "main" com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused: connect. Verify the connection properties, check that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port, and that no firewall is blocking TCP connections to the port.".
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:171)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1033)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:817)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:700)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:842)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
at java.sql.DriverManager.getConnection(DriverManager.java:233)
at DbConnect.main(DbConnect.java:11)
C:\Users\Nitish\AppData\Local\NetBeans\Cache\8.1\executor-snippets\run.xml:53: Java returned: 1
Before giving up, thought to check here...
Your commented-out connection string suggests you are connecting to a named instance. A default SQL Server instance (not-named) listens on port 1433 unless configured otherwise. A named instance uses a dynamic port, which is not 1433, unless configured otherwise. One can have only one default instance per machine and every SQL instance must listen on a different port.
You can identify the port a SQL instance is listening on using SQL Server Configuration Manager or by viewing the SQL Server error log. The error log will include messages for each interface and port SQL Server is listening on. The message will be like "Server is listening on [ 'any' 1433]." The port can be changed using SSCM and will be effective after restarting the SQL Service.
To test port connectivity, you can use TELNET:
TELNET YourServer 1433
You'll see and empty window if the connection is successful, otherwise and error.
If you don't have TELNET installed, you can test the port connectivity with this Powershell command from a command-prompt window:
powershell -Command echo ((new-object Net.Sockets.TcpClient).Client.Connect('YourServer', 1433)) 'success'
You'll see the success message upon successful connection, otherwise a socket exception.
Note that the dynamic port is assigned during installation and the instance will attempt to use the same port upon each startup. However, be aware the port number could change if that port is unavailable at startup. One can configure a static port (including port 1433) using SSCM to avoid the port number changes of a named instance.
I am trying to start sync_gateway from cmd with following command:
sync_gateway -url http://75.76.221.21:8091
I received following error:
20:33:23.014229 WARNING: Error installing Couchbase design doc: Put
http://192.168.2.102:8092/sync_gateway/_design/sync_gateway: dial tcp
192.168.2.102:8092: ConnectEx tcp: 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. -- db.installViews() at database.go:29120:33:44.055739
WARNING: Error installing Couchbase design doc: Put
http:/_design/sync_housekeeping: dial tcp 192.168.2.102:8092:
ConnectExtcp: 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. --
db.installViews() at database.go:30520:33:44.055739
FATAL: Error opening database: Put
192.168.2.102:8092/omnibazaar/_design/sync_housekeeping: dial tcp 192.168.2.102:8092: ConnectEx tcp: 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. -- rest.RunServer() at config.go:415
How did you name your nodes in your Couchbase instance? If you look at the Server Nodes tab, is one of your nodes named "192.168.2.102". I see that from your sync gateway machine, you are trying to reach the Couchbase cluster using the 75.76.221.21 address. Have you checked network connectivity, from your sync gateway machine, try "telnet 192.168.2.102 8092" and see if it connects.
One other thing, it is more common to start sync gateway by redirecting in a configuration file, you can find them in the examples directory. For instance "sync_gateway < examples/config-server.json"
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
We have a clan MySQL database that tracks player stats in a game. There person in charge of our MySQL is away at the moment and we are getting this following Error
[18:17:18 23] Error in Tablebuilder:
[18:17:18 23] Message: Unable to connect to any of the specified MySQL hosts.
[18:17:18 23] Native: -2147467259
[18:17:18 24] Source: MySql.Data
[18:17:18 24] StackTrace: at MySql.Data.MySqlClient.NativeDriver.Open()
at MySql.Data.MySqlClient.Driver.Open()
at MySql.Data.MySqlClient.Driver.Create(MySqlConnecti onStringBuilder settings)
at MySql.Data.MySqlClient.MySqlPool.GetPooledConnecti on()
at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
at MySql.Data.MySqlClient.MySqlPool.GetConnection()
at MySql.Data.MySqlClient.MySqlConnection.Open()
at PRoConEvents.CChatGUIDStatsLoggerBF3.tablebuilder( )
[18:17:18 24] InnerException: System.Net.Sockets.SocketException: 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 50.63.244.184:3306
at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
at MySql.Data.Common.StreamCreator.CreateSocketStream (IPAddress ip, Boolean unix)
at MySql.Data.Common.StreamCreator.GetStreamFromHost( String pipeName, String hostName, UInt32 timeout)
at MySql.Data.Common.StreamCreator.GetStream(UInt32 timeout)
at MySql.Data.MySqlClient.NativeDriver.Open()
[18:17:18 24] Error: System.NullReferenceException: Object reference not set to an instance of an object.
at PRoConEvents.CChatGUIDStatsLoggerBF3.tablebuilder( )
Any ideas what the issue could be?
You should start by reading error messages. They look like gibberish but when you read closely, often there is a part it tells you what's going on.
[18:17:18 24] InnerException: System.Net.Sockets.SocketException:
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 50.63.244.184:3306
You should now:
Execute telnet localhost 3306 from the database server and if it fails, it's an issue with the DB server
Execute telnet 50.63.244.184 3306 from the application server and if it fails, it's an issue with the network
You have two exceptions, them tested, but the meaning is clear:
"Unable to connect to any of the specified MySQL hosts."
and
"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"
So in short: your webserver cannot connect to you database server. Your database server (the MySQL server process mysqld.exe or the server itself, like its OS, hardware, anything) might be stopped. Or the firewall was reset to block connections on the MySQL port 3306. It could be anything.
I assume you've got a standard webhost - ping them and ask them why your database server isn't operational.
...but before you embarrass yourself, make sure that your application is connecting to the right server (i.e. production DB, not dev or staging DB). Take a look at your connection string.