ASP.NET Core + Heroku. Database migration - database

I want to update database on Heroku using migration in ASP.NET Core.
I used correct connection string (DATABASE_URL), but when I run command
update-database
from Package Manager Console, I get message
Format of the initialization string does not conform to specification starting at index 0.
I'll leave my connection string format here:
postgres://odb...:5670...#ec2-54-243-54-6.compute-1.amazonaws.com:5432/2d...

I thought that DATABASE_URL format is good, but it's not, you need to use Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;,
PLUS in the end I passed two additional parameters: Sslmode=Require; and Trust Server Certificate=true.

Related

SSIS to Oracle "Could not create a managed connection manager."

I'm trying to use SSIS to load some data from Oracle database to MSSQL database.
I created the project and used the ADO.Net source and was able to create a connection to Oracle and run queries and view results.
However when I actually run the package I get the following error:
Error: 0xC0208449 at Data Flow Task, ADO NET Source 2: ADO NET Source has failed to acquire the connection {EECB236A-59EA-475E-AE82-52871D15952D} with the following error message: "Could not create a managed connection manager.".
It seems similar to the issue here
And I did find that I have two oracle clients version installed "11.1" and "12.2".
One is used by PL/SQL and the other by other entity framework project.
If this is the issue I just wanted a way to tell the SSIS to pick-up the correct one.
I tried adding Entry in machine.config for "oracle.manageddataaccess.client" section with the desired version.
I also tried using other types of data sources but couldn't even create a successful connection
I tried changing the Run64bitRuntime property in the project to False
Note: I don't have SSIS installed on my machine.
Eventually, I just had to remove the entries related to 11.1 in path variable then restarted my machine.
Also I switched to "dotConnectForOracle" for connection and now it seems to be working fine.
I'm expecting issues related to other applications that might still be using the 11.1 version, but that will be a problem for another day.
Always make sure to write the user (oracle schema) in uppercase and some special characters [in my case it was $] in the password needs escape character even if you're using the wizard not the cmd
I still don't understand the whole issue but I hope this helps someone some day.

Connection string Error when trying to make Installation

I made EntityFramework (6) CodeFirst WinForms application
On my machine it works fine but when I'm trying to make Installation (with VS 2015 Installing projects) of my project and to run it on another machine, I get Expansion of Data Directory failed
I'm really dont understand- when I'm trying to change db name in ConnectionString to some wrong name- it still works.
My connection string in app config:
I found what was the problem. It is not enough to pass the name of connection string via Entity context constructor :base(ConnectionString). Entity context name MUST be the same as Connection string in app config. Other way EF create some another db.

SQL Server 2014, SSDT : deploying .dtsx packages to live, problems with connection managers & variables

Summary: A "master" database houses a set of connection strings. A .dtsConfig XML file is used to point the packages to this database. Dynamic connection assignment accomplished by using package variables and expressions on the connections. Works flawlessly in the development environment, but once deployed to live it falls over.
I'm currently running into issues when deploying .dtsx packages to a production environment. The issue is specifically related to the connection manager when the jobs run. The history log reports a ... network ... error with a Login timeout error as the reason.
(For reference, I'm using Visual Studio 2013 with SQL Server Data Tools)
I have a table in a master database that holds the connection strings that it needs to process.
The packages check for a configuration file, that points them to the database as stipulated in (1).
The connections are retrieved and are placed in an object variable.
The variable is mapped to a foreach loop container, where a set of connection string variables are mapped to the relevant columns.
The packages then progress as normal.
Some notes:
When I did the development, I provided default values on my network for the connection strings.
I have checked the connection string parameters and formatting inside the database, and they conform to Microsoft's specification.
Our implementers installed SSDT on a client's QA server, where I altered the connection variables to point to their network. This solved the problem, but it is not sustainable (in my mind at least).
So my question is: how do I get my production deployments to work correctly with dynamic connection management assignment without having to alter the connection string variables inside each package on a per client basis?
Any help will be appreciated.
After doing more research by posing plenty of questions to DuckDuckGo, I finally got my answer here.
A quote from the above blog:
I had a set of SSIS packages running for my client using the third option listed above. The packages worked fine for ages until one fine day when they failed. The logs showed the packages had failed validation and I discovered that all the packages had their connection managers’ DelayValidation property set to False. The variable used to set the connection string had a default value pointing to the DEV server. These packages in production were actually trying to validate against DEV database though the connection string was dynamically set via a variable to point to PROD. This was dangerous as the jobs will not run if DEV server was down, which is exactly what had occurred.

EF Code first after deployment throws ProviderIncompatibleException

I have a simple EF 5.0 / Code First application developed in VS2012. In development it uses SQL Server CE. However, when I deployed it on a test server, I am getting the following stack of errors:
ProviderIncompatibleException: An error occurred while getting provider information from the database.
This can be caused by Entity Framework using an incorrect connection string.
Check the inner exceptions for details and ensure that the connection string is correct.
ProviderIncompatibleException: The provider did not return a ProviderManifestToken string
SqlException (0x80131904): Login failed for user 'MYDOMAIN\MYSERVER$'
IIS and the database are on the same server (MYSERVER). It's running Win2012, (with IIS 8 and .NET 4.5) and SQL Server 2012.
There are two things in web.config that caught my attention. First, connection string. I generated it from IIS UI; and I used my old connection strings that had "Data Source", rather than server. I used localhost and server name. I created a db user. I read somewhere that the database doesn't exist - so I deleted it. I gave permissions to NT AUTHORITY\NT SERVICE in the database. I probably did some other permutations - but the result is always the same.
The second place was Connection Factory under entity framework section. Apparently, it wasn't changed by Web Deploy; type was still SqlCeConnectionFactory, and parameter was System.Data.SqlServerCe.4.0. I saw somewhere that SQL Server was the default - so I deleted it; and when that didn't work, I changed the values to SqlConnectionFactory and System.Data.SqlServer correspondingly - but again, result is the same.
By now I ran out of ideas... Given that I have a problem even when I am reading the data from existing database - I am missing something simple...

Specifying a named SQL Server instance for nhibernate

I've been making a first attempt to use fluent nHibernate on an ASP.NET MVC 3 application. Because I have multiple instances of SQL Server Express, I've been trying to specify a named instance along with the server while creating a session factory with the Fluently.Configure() method. My connection string for the database is of the format:
Server=myServerName\theInstanceName;Database=myDataBase;Trusted_Connection=True;
This causes an nHibernate exception reading:
Format of the initialization string does not conform to specification
starting at index 19
where the index given corresponds to the slash before the instance name. This connection string works fine with Entity Framework 4. So how am I to specify the named instance I want to connect to in nHibernate?
Since you are doing that in code, you must escape the \ either by doubling it (\\) or by using a verbatim string:
connectionString = #"Server=myServerName\theInstanceName;Database=myDataBase;..."
Otherwise, \t is interpreted as the tab character.

Resources