tediousjs / node-mssql

Microsoft SQL Server client for Node.js
https://tediousjs.github.io/node-mssql
MIT License
2.23k stars 468 forks source link

Integrate msnodesqlv8 with Typeorm #1423

Closed annumsin closed 2 years ago

annumsin commented 2 years ago

I have to implement Window Authentication in Nestjs + mssql which uses TypeOrm so after lots of findings msnodesqlv8 driver was the most recommended but I don't find enough information to do so from the documentation so please advice

Expected behaviour:

Window Authentication should work with msnodesqlv8 + TypeOrm

Actual behaviour:

I tried this snippet -

@Module({ imports: [ ConfigModule.forRoot(), TypeOrmModule.forRoot({ type: 'mssql', url: 'Driver=msnodesqlv8;Server=W70100\SQLEXPRESS01;Database=Test;Trusted_Connection=Yes' }); });

I got this error - ConnectionError: Failed to lookup instance on river=msnodesqlv8;Server=W70100 - getaddrinfo ENOTFOUND river=msnodesqlv8;Server=W70100

so, please if you can correct or provide the right snippet or even example also helps also I have made sure following points are taken care -

dhensby commented 2 years ago

I'm not knowledgeable in typeORM so I can't provide much guidance here.

When using msnodesqlv8 a different import is needed from the library as it is exposed via a separate file. I don't know how TypeORM deals with that, but it may mean you need to create a custom DB adapter.

Sorry I can't be of more help.