I have a SSIS package that is using SSIS Configuration table in a SQL server to retrieve the connection string property for a OLE DB connection manager.
Thing is that I also need that same connection string to invoke an assembly that uses Entity Framework. I've tried to access the connection manager connection string property but SSIS always strips the password so the connection string goes incomplete to the EF Code First Context and gives login errors.
Any ideas to overcome this?! thanks
I've already gone another path. It seems that the connection string property in the configuration manager always "hides" the password for security reasons so I'm not reusing that property and instead I'm getting all I need from the SSIS configuration file.
Related
seems there is no good way to encrypt database connect string for azure website (not cloud service), i already view the solution here
but, i can't store the database first entity framework connect string in the azure website setting, which will get below error, anyone knows how to make data base connect string secure in azure website using database first entity framework?
System.Data.Entity.Infrastructure.UnintentionalCodeFirstException: The context is being used in Code First mode with code that was generated from an EDMX file for either Database First or Model First development. This will not work correctly. To fix this problem do not remove the line of code that throws this exception. If you wish to use Database First or Model First, then make sure that the Entity Framework connection string is included in the app.config or web.config of the start-up project. If you are creating your own DbConnection, then make sure that it is an EntityConnection and not some other type of DbConnection, and that you pass it to one of the base DbContext constructors that take a DbConnection. To learn more about Code First, Database First, and Model First see the Entity Framework documentation here: http://go.microsoft.com/fwlink/?LinkId=394715
You don't have to include the connection string in the web.config for your site. You can manage the connection string in your azure account at:
App Services>[your_app_name]>Settings>Application settings
Under Connection strings section, you can set the key/value pair which is the connection name and the db connection string.
After you set those values, in the screen, the connection string will be hidden for display.
I am writing a linqpad script for migrating data into a db from an excel file. Once the data has been imported it needs to be synchronized between multiple dbs. This has been done in a dll as the functionality is used elsewhere.
My issue is that when passing a connection string to my dll from linqpad I get the message Login failed for user 'xxxxxxx'. As far as I can tell it is because the password for the SQL authentication is not passed in the connection string. IS there any way to make linqpad include the password in the connection string:
SyncController syncController = new SyncController(this.Connection.ConnectionString);
syncController.SyncAll();
If it is at all possible I want to avoid forcing the person who will be running this to update a password variable when running this. Thanks.
You're right: the password will disappear from the connection string after the connection is opened. This is a feature of the .NET Framework, and is not specific to LINQPad.
There are two workarounds. First, you can capture the connection string as the first line in your LINQPad script, before querying any data:
string cxString = this.Connection.ConnectionString;
The other workaround is to add the following text to your connection string:
Persist Security Info=true
To do this in LINQPad, right-click the connection and choose Properties. Click Advanced, and enter the additional connection string text into the box provided.
I'm developing a program using entity framework with WPF and using a SQL credentials on the database.
When deploying the program it produces the program.exe.config file which contains the connection string. Any user can open it and see the credentials data (SQL username & password). I searched to figure out a way to hide them or encrypt but nothing useful in my case. I found that entity using base variable to get the connection from the app.config but when I tried after many ways to pass the connection string directly an the right way I faced a problem about the provider in the connection string.
[Solved]
i let the connection with app.config but with fake data for username and password .
then i created a setting to store the connection string . and at the instantiating of the db entity i changing the connection property stored in the settings . so i guess that your connection is safe now .
how can i manage connection string of an ADO.net Object model dynamically?
i have connected my application to database using Entity Framework and connection string is automatically added to app.config. how can i get list of available servers and change connections string based on that in the run-time?
Just because VS adds the connection string to app.config by default it doesn't mean that is a good idea and if you do keep the connection string there you cannot change it at run time.
One solution is to keep encrypted connection string in your settings and that will allow you to dynamically change it at run time by simply calling:
Settings.Default.Save();
and
Settings.Default.Reload();
I am using the enterprise library logging and exception handling.
Currently I am adding the connection string in the configuration file, and this means that it is static.
My problem is that the user may connect to a different database each time depending on his user name. Is there any way to change the connection string at run time?
I created a CustomTraceListener
You can set the Connection string at run time by using ConfiguratiomManager class from System.Configuration namaspace as below;
ConfigurationManager.ConnectionStrings[0].ConnectionString = "Your new Connection string";