Is it correct to make connection string dynamic?

Atilla Rüstəmli 40 Reputation points
2024-05-20T19:12:10.4966667+00:00

Hi, I'm currently working on a project which need data from other databases. The database where I'll get the datas are depends on users. Now I want to make my connectionString dynamic. Is it correct to make connection strnig dynamic. The user will enter the connection string registration and I'll save it in my local database. And then I will get datas from there with adonet. Is it right way of coding or there is other ways to do this better?

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
749 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,948 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 66,061 Reputation points
    2024-05-20T20:06:21.26+00:00

    the only real issue is security. if the connect string require user and password, then you need to securely store the string. if the connection is integrated, then if the app is a desktop app, no issue, but if website, then the connection will be made with the pool account. a user could enter another users connection string to access their data.


  2. SurferOnWww 3,031 Reputation points
    2024-05-21T00:39:09.69+00:00

    The user will enter the connection string registration and I'll save it in my local database. And then I will get datas from there with adonet. Is it right way of coding or there is other ways to do this better?

    I do not think it (i.e., "The user will enter the connection string") is good idea due to security reasons. Why don't you create the user-dependent connection string at the server side?


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.