r2dbc/r2dbc-mssql

MssqlConnectionConfiguration schema option.

omuralcin-ge opened this issue · 4 comments

Feature Request

I searched it on Github and Stackoverflow but I didn't find anything about this feature.
I am using MSSQL database and I want to create schema for each tenants.
While I was designing per-schema multitenancy for mssql database I needed to add new schema name to connections of the each tenants like postgresql above :

protected PostgresqlConnectionConfiguration.Builder getPostgresqlConnectionConfigurationBuilder(String schema) {
    return PostgresqlConnectionConfiguration
            .builder()
            .username(dbUser)
            .password(dbPassword)
            .host(dbHost)
            .port(dbPort)
            .database(dbName)
            .schema(schemaName);
}

There is a schema option for PostgresqlConnectionConfiguration at the r2dbc-postgresql for this work but r2dbc-mssql doesn't provide schema option yet.So I couldn't add schema name to my mssql connection config.

Please add new feature for schema option to MssqlConnectionConfiguration class.

Best Regards.

Care to elaborate? As far as I know, there's no direct support to set the namespace (owner namespace) through a driver other than logging into the database with an according user. Does the JDBC SQL Server driver have such an option?

@mp911de I guess it's about user functionality not JDBC session for mssql. I found this answer about the JDBC schema option for mssql at the SO.

@mp911de do you have an idea for this situation?

The schema is a MS SQL-specific behavior that cannot be set through the driver/client. While Postgres allows setting a session variable to tell the session in which schema to look for a database object, but SQL Server doesn't support that.

The only thing I found so far is the default schema for a user but that is nothing we can affect from a driver side.

Therefore, I'm closing this ticket because it isn't actionable.