diff --git a/packages/web/src/settings/ConnectionDriverFields.svelte b/packages/web/src/settings/ConnectionDriverFields.svelte index cc5b04d7..997b78c7 100644 --- a/packages/web/src/settings/ConnectionDriverFields.svelte +++ b/packages/web/src/settings/ConnectionDriverFields.svelte @@ -164,6 +164,10 @@ /> {/if} +{#if driver?.showConnectionField('windowsDomain', $values)} + +{/if} + {#if driver?.showConnectionField('isReadOnly', $values)} {/if} diff --git a/plugins/dbgate-plugin-mssql/src/backend/tediousDriver.js b/plugins/dbgate-plugin-mssql/src/backend/tediousDriver.js index 67f6a4ed..56b46753 100644 --- a/plugins/dbgate-plugin-mssql/src/backend/tediousDriver.js +++ b/plugins/dbgate-plugin-mssql/src/backend/tediousDriver.js @@ -22,7 +22,7 @@ function extractTediousColumns(columns, addDriverNativeColumn = false) { return res; } -async function tediousConnect({ server, port, user, password, database, ssl, trustServerCertificate }) { +async function tediousConnect({ server, port, user, password, database, ssl, trustServerCertificate, windowsDomnain }) { return new Promise((resolve, reject) => { const connectionOptions = { encrypt: !!ssl, @@ -43,10 +43,11 @@ async function tediousConnect({ server, port, user, password, database, ssl, tru server, authentication: { - type: 'default', + type: windowsDomnain ? 'ntlm' : 'default', options: { userName: user, password: password, + ...(windowsDomnain ? { domain: windowsDomnain } : {}), }, }, diff --git a/plugins/dbgate-plugin-mssql/src/frontend/driver.js b/plugins/dbgate-plugin-mssql/src/frontend/driver.js index f696916c..14711e1f 100644 --- a/plugins/dbgate-plugin-mssql/src/frontend/driver.js +++ b/plugins/dbgate-plugin-mssql/src/frontend/driver.js @@ -127,13 +127,16 @@ const driver = { ['authType', 'server', 'port', 'user', 'password', 'defaultDatabase', 'singleDatabase', 'isReadOnly'].includes( field ) || - (field == 'trustServerCertificate' && values.authType != 'sql' && values.authType != 'sspi'), + (field == 'trustServerCertificate' && values.authType != 'sql' && values.authType != 'sspi') || + (field == 'windowsDomain' && values.authType != 'sql' && values.authType != 'sspi'), + // (field == 'useDatabaseUrl' && values.authType != 'sql' && values.authType != 'sspi') getQuerySplitterOptions: () => mssqlSplitterOptions, engine: 'mssql@dbgate-plugin-mssql', title: 'Microsoft SQL Server', defaultPort: 1433, defaultAuthTypeName: 'tedious', + // databaseUrlPlaceholder: 'e.g. server=localhost&authentication.type=default&authentication.type.user=myuser&authentication.type.password=pwd&options.database=mydb', getNewObjectTemplates() { return [