prisma / tiberius

TDS 7.2+ (Microsoft SQL Server) driver for Rust
Apache License 2.0
321 stars 118 forks source link

An error occured during the attempt of performing I/O: tls handshake eof #274

Open vylink opened 1 year ago

vylink commented 1 year ago

Hi There,

I'm trying to perform simple query against MSSQL server, but getting:

An error occured during the attempt of performing I/O: tls handshake eof

Any idea what could be wrong on the following code?

main.rs

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let mut config = tiberius::Config::new();
    config.host("127.0.0.1");
    config.port(8089);
    config.database("SOMEDATABASE");
    config.authentication(tiberius::AuthMethod::sql_server("SOMEUSER", "SOMEPASSWORD"));
    config.trust_cert();
    let tcp = TcpStream::connect(config.get_addr()).await?;
    tcp.set_nodelay(true)?;
    let mut client = Client::connect(config, tcp).await?;
    Ok(())
}

Cargo.toml

    [dependencies]
    tokio = { version = "1.24.1", features = ["full"] }
    anyhow = "1"
    tiberius = { version = "0.11", features = [
        "chrono",
        "rustls",
        "tds73",
    ], default-features = false }
    async-std = "1.12.0"

    [dependencies.tokio-util]
    version = "0.7.7"
    features = ["compat"]
pimeys commented 1 year ago

Probably server TLS and rustls don't co-operate very well. Did you try with native-tls and OpenSSL?