1

While trying to connect to SQLAnywhere (Sybase) database (C# code) from Azure ServiceFabric:

await using var connection = new SAConnection(connectionString);
await connection.OpenAsync();

receive iAnywhere.Data.SQLAnywhere.SAException

Connection error: Connection was dropped (may not be a SQL Anywhere server)

Error code is Error 832. This is generic connection error: An error occurred while attempting to establish a connection with the database server, but before attempting to connect to a database. Failure to initialize a communication link during the connection attempt is an example of this error. Creating a debug log file using the LogFile connection parameter may provide more information.

Locally it works, but does not work from Service Fabric.

Fix ideas tried:

  1. Missing driver? Looks like no, Sybase (now SAP) SQLAnywhere requires special driver or client - but locally also works without this driver, just with iAnywhere.Data.SQLAnywhere.NETCore nupackage installed
  2. Network connection/ firewall problems? Looks like no, database server can be pinged from Service Fabric node
avj
  • 1,626
  • 1
  • 19
  • 23

2 Answers2

1

It was another traffic protection tool. Although it was possible to telnet the port, still traffic from app was blocked by another tool.

avj
  • 1,626
  • 1
  • 19
  • 23
  • And another huge problem was - slow speed with new .net core version of this package. Turns out, it cannot handle outgoing parameters well - the defined size of parameter will actually be send out: ``` var yourOutParameter = new SAParameter("@OutMsg", SADbType.Binary) { Direction = ParameterDirection.Output, Size = 256000000, IsNullable = true }; ``` So check what is actual message size for your responses, maybe 1 megabyte or even kilobytes are enough, and set size parameter accordingly. – avj Jan 26 '21 at 09:48
1

Had a similar issue - turned out that whilst standard incoming traffic from the Sybase Server had been whitelisted in our Firewall, encrypted traffic from this had not been.

This meant I could ping and connect with Telnet, but got the same error when trying to log-in with my credentials

Connection error: Connection was dropped (may not be a SQL Anywhere server)

Our comms team solved the issue by whitelisted encrypted traffic from the server address as well. They also mentioned it possibly could have been solved we shared a valid security certificate for the encrypted data with their team, but were happy with the first course of action.

Simple_Jon
  • 11
  • 1