We run a dbx job that uses a jdbc connection to three (SQL Server) on-prem databases. Very occasionally a connection will go to the wrong server.
In the job log we see the error "com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'xxxxxx". We also log the used username and ip address (to rule out a DNS problem we use ip addresses in the connection string) so we are certain about what the connection is trying to do.
On the SQL Server side, we see the error "Login failed for user 'xxxxxx'." But, on a different server.
The code we have to execute queries is:
df = (spark.read
.format("jdbc")
.option("url", f"jdbc:sqlserver://{ip};databaseName={self.connection.database};encrypt=true;trustServerCertificate=true")
.option("query", statement)
.option("sslProtocol", "TLSv1.2")
.option("user", self.connection.user)
.option("password", pw)
)
ICT has checked the ip traffic logs and verified what happens (though cannot explain it either).
Lastly, to give the word "occasional" more meaning... Our job runs every hour and performs 50+ queries per run. We have this problem once every 5-ish runs (but unpredictable). We don't see any pattern in the timing.