Open kzhui125 opened 1 month ago
Can you share the error you're seeing? That might help narrow things down.
Out of curiousity, does it work without the winauth
feature?
[dependencies]
tiberius = { version = "0.12", default-features = false, features = [
# "rustls",
# "native-tls",
"vendored-openssl",
"tds73",
] }
tokio = { version = "1", features = ["full"] }
tokio-util = { version = "0.7", features = ["compat"] }
tested without winauth
, and tested with rustls
, native-tls
, vendored-openssl
use tiberius::{AuthMethod, Client, Config, EncryptionLevel};
use tokio::net::TcpStream;
use tokio_util::compat::TokioAsyncWriteCompatExt;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut config = Config::new();
config.host("192.168.50.74");
config.port(1433);
config.authentication(AuthMethod::sql_server("user", "password"));
config.encryption(EncryptionLevel::Off);
config.trust_cert();
let tcp = TcpStream::connect(config.get_addr()).await?;
tcp.set_nodelay(true)?;
let _client = match Client::connect(config, tcp.compat_write()).await {
// Connection successful.
Ok(client) => client,
Err(e) => Err(e)?,
};
Ok(())
}
Error: Io { kind: UnexpectedEof, message: "tls handshake eof" }
get error after long time:
Error: Tls("connection closed via error")
Error: Tls("unexpected EOF")
sql server version:
SELECT @@VERSION
Microsoft SQL Server 2014 (SP2) (KB3171021) - 12.0.5000.0 (X64) Jun 17 2016 19:14:09 Copyright (c) Microsoft Corporation Enterprise Edition (64-bit) on Windows NT 6.3 <X64> (Build 9600: ) (Hypervisor)
openssl:
openssl -v
OpenSSL 3.3.2 3 Sep 2024 (Library: OpenSSL 3.3.2 3 Sep 2024)
Thanks @NTmatter
I have tested rustls/vendored-openssl feature, it doesn't work for macOS 15 connecting to SQL Server 2014 in Windows Server 2012 R2