2

I am using .Net Core 2.1 to build an application and below is my appsetting.json file entry for the data connection. I am using an alias to connect to the database. This setting works for Microsoft .NET Framework 4.7.2 app but not for the .Net Core app.

I am using IBM.Data.DB2.Core NuGet package. If I replace myaliasname with the actual database name it connects successfully. I do not want to use the direct connection as the alias has alternate connections defined in case of failure.

"ConnectionStringOptions": {
    "datasource": "Database=myaliasname;UID={0};PWD={1};Pooling=true;Min Pool Size=1;Max Pool Size=100;"
  }

How can I use an alias in .Net Core app for Db2?

mustaccio
  • 18,234
  • 16
  • 48
  • 57
panaroma
  • 21
  • 7
  • How exactly did you define the alias? – mustaccio Oct 28 '19 at 22:39
  • 2
    .Net Core does not support sql alias since it is not cross-platform, refer to https://stackoverflow.com/questions/45327293/issues-with-sql-alias-in-connectionstring-in-appsettings-json – Ryan Oct 29 '19 at 01:42

0 Answers0