I'm on a Mac, running a SQL Server database via Docker. When I try to connect and execute queries via sqlcmd, I am able to. However, tiberius is not working for me. It appears that SQL Server is allocating a dynamic port for some reason. I guess my questions are:
Why is the tiberius connection being given a dynamic port when sqlcmd isn't? This isn't a named instance, which afaik is what triggers mssql to allocate a dynamic port.
Is there a workaround? I only see options for using SCM to turn off dynamic ports. I can't find any configuration via env vars or the mssql command that can turn it off. I would prefer not to forward all of my ports to the docker container, if possible.
Any advice is very much appreciated 🙂
Repro:
use tiberius::Config;
use tokio::net::TcpStream;
use tokio_util::compat::TokioAsyncWriteCompatExt;
#[tokio::main]
async fn main() -> Result<()> {
let tcp = TcpStream::connect(Config::new().get_addr()).await?;
println!("{:?}", tcp);
Ok(())
}
I'm on a Mac, running a SQL Server database via Docker. When I try to connect and execute queries via
sqlcmd
, I am able to. However, tiberius is not working for me. It appears that SQL Server is allocating a dynamic port for some reason. I guess my questions are:Any advice is very much appreciated 🙂
Repro:
Outputs:
PollEvented { io: Some(TcpStream { addr: [::1]:61434, peer: [::1]:1433, fd: 11 }) }