I'm having difficulties accessing my SQL Server database hosted on Azure via the SQLx library.
I am able to connect to my database using pymssql:
conn = pymssql.connect(server='SERVER.database.windows.net', user='USER', password='PASSWORD', database='DATABASE')
Therefore, I assume that my settings in the Azure Portal are all correct and the problem lies indeed with my SQLx code.
Using the same credentials, I tried connecting to the database:
let mut connection = MssqlConnection::connect(
"mssql://USER:PASSWORD@SERVER.database.windows.net/DATABASE").await?;
However this results in
Error: Io(Kind(ConnectionAborted))
and according to the rust std::io error docs this error means:
The connection was aborted (terminated) by the remote server
I'm wondering whether this error message is accurate since I wouldn't know why the remote would terminate the connection. Furthermore, these calls don't show up in the metrics tab, therefore I'm thinking that the requests never made it to the server.
I'm importing the tokio and sqlx crates like this:
sqlx = { version = "0.5.9", features = [ "runtime-tokio-native-tls" , "mssql" ] }
tokio = { version = "1.14.0", features = ["full"] }
Does anyone know what this error means/what I'm doing wrong?