Skip to content

Connection option "trustServerCertificate" seems broken/not supported #946

Closed
@brantz

Description

@brantz

activerecord-sqlserver-adapter (6.1.0.0)
tiny_tds (2.1.5)

I am trying to set the connection option trustServerCertificate but it seems i can't get it to work.

I have tried adding the option as a query parameter to DATABASE_URL, like so:

sqlserver://<user>:<pwd>@<host>:<port>/<db_name>?trust_server_certificate=true

That didn't work so i tried various spellings of trustServerCertificate like trust_server_certificate or trustservercertificate.

Neither had done the trick, they simply seem to be ignored.

Then i found https://github.com/rails-sqlserver/activerecord-sqlserver-adapter#configure-connection and tried setting it via an rails initializer like so:

module ActiveRecord
  module ConnectionAdapters
    class SQLServerAdapter < AbstractAdapter
      def configure_connection
        raw_connection_do "SET TRUST_SERVER_CERTIFICATE ON"
      end
    end
  end
end

This resulted in TinyTds::Error: 'TRUST_SERVER_CERTIFICATE' is not a recognized SET option.

Well, it was worth a shot ;)

Documentations for both TinyTds & AR sqlserver adatper do not mention mention anything about that connection option.

Any help on this would be greatly appreciated :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions