sequelize / sequelize-typescript

Decorators and some other features for sequelize
MIT License
2.78k stars 280 forks source link

Failed to connect to *name_server* - getaddrinfo ENOTFOUND #997

Open eugenestepanyuk opened 3 years ago

eugenestepanyuk commented 3 years ago

Issue

Versions

Issue type

Actual behavior

an error occurs when connecting the server to the database Failed to connect to ANJUTA2 \ SQL2016: 1433 - getaddrinfo ENOTFOUND ANJUTA2 \ SQL2016

how to make a connection only by name (ANJUTA2 \ SQL2016), why does it tighten the port if I do not specify it?

Expected behavior

connection only by name (ANJUTA2 \ SQL2016)

Related code

tsconfig

"compilerOptions": {
      "target": "es6",
      "module": "commonjs",
      "lib": ["dom", "es6", "es2017", "esnext.asynciterable"],
      "sourceMap": true,
      "outDir": "./dist",
      "rootDir": "./source",
      "moduleResolution": "node",
      "removeComments": true,
      "noImplicitAny": true,
      "strictNullChecks": true,
      "strictFunctionTypes": true,
      "noImplicitThis": true,
      "noUnusedLocals": true,
      "noUnusedParameters": true,
      "noImplicitReturns": true,
      "noFallthroughCasesInSwitch": true,
      "allowSyntheticDefaultImports": true,
      "esModuleInterop": true,
      "emitDecoratorMetadata": true,
      "experimentalDecorators": true,
      "resolveJsonModule": true
    },
    "exclude": ["node_modules"],
    "include": ["./source/**/*.tsx", "./source/**/*.ts"]
  }

Sequelize connection

import { Sequelize } from 'sequelize-typescript'
import { environment } from '../config'
import { normalize, join } from 'path'

export default new Sequelize({
  database: environment.database.database,
  dialect: "mssql",
  username: environment.database.username,
  password: environment.database.password,
  host: environment.database.host,
  logging: !environment.production ? console.log : false,
  models: [normalize(join(__dirname, "..", "models"))],
  dialectOptions: {
    options: {
      enableArithAbort: true,
      cryptoCredentialsDetails: {
        minVersion: "TLSv1",
      },
    },
  },
})
SlavaDen commented 3 years ago

Good afternoon Did you manage to fix the error ? How did you connect to mssql I have a similar error, I can't connect to the server Although there is definitely access