mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-24 18:45:59 +00:00
Merge pull request #1184 from daujyungx/master
fix: #340, SQL Server tedious driver connect to named instance
This commit is contained in:
@@ -66,14 +66,16 @@ async function tediousConnect(storedConnection) {
|
|||||||
const authentication = await getAuthentication(storedConnection);
|
const authentication = await getAuthentication(storedConnection);
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
const [host, instance] = server.split('\\');
|
||||||
const connectionOptions = {
|
const connectionOptions = {
|
||||||
|
instanceName: instance,
|
||||||
encrypt: !!ssl || authType == 'msentra' || authType == 'azureManagedIdentity',
|
encrypt: !!ssl || authType == 'msentra' || authType == 'azureManagedIdentity',
|
||||||
cryptoCredentialsDetails: ssl ? _.pick(ssl, ['ca', 'cert', 'key']) : undefined,
|
cryptoCredentialsDetails: ssl ? _.pick(ssl, ['ca', 'cert', 'key']) : undefined,
|
||||||
trustServerCertificate: ssl ? (!ssl.ca && !ssl.cert && !ssl.key ? true : ssl.rejectUnauthorized) : undefined,
|
trustServerCertificate: ssl ? (!ssl.ca && !ssl.cert && !ssl.key ? true : ssl.rejectUnauthorized) : undefined,
|
||||||
enableArithAbort: true,
|
enableArithAbort: true,
|
||||||
validateBulkLoadParameters: false,
|
validateBulkLoadParameters: false,
|
||||||
requestTimeout: 1000 * 3600,
|
requestTimeout: 1000 * 3600,
|
||||||
port: port ? parseInt(port) : undefined,
|
port: port && !instance ? parseInt(port) : undefined,
|
||||||
trustServerCertificate: !!trustServerCertificate,
|
trustServerCertificate: !!trustServerCertificate,
|
||||||
appName: 'DbGate',
|
appName: 'DbGate',
|
||||||
};
|
};
|
||||||
@@ -83,7 +85,7 @@ async function tediousConnect(storedConnection) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const connection = new tedious.Connection({
|
const connection = new tedious.Connection({
|
||||||
server,
|
server: host,
|
||||||
authentication,
|
authentication,
|
||||||
options: connectionOptions,
|
options: connectionOptions,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user