Connection reset while streaming data from MS SQL server using Alpakka Slick connector


I am getting the following error when reading data from MS SQL server using Alpakka slick connector using Akka Streams: Connection reset

It processes few records and then suddenly came up the error. Can anyone please help me with this that what can be the reason for the connection reset issue?


val db = slick.jdbc.JdbcBackend.Database.forURL(connectionString)
val fetchSize = 50000
val profile = profileName match {
  case MSSQLServer => slick.jdbc.SQLServerProfile
  case Postgres => slick.jdbc.PostgresProfile
implicit val session: SlickSession = SlickSession.forDbAndProfile(db, profile)
import session.profile.api._
  fetchSize = fetchSize