EF Code First Mysql to SQL Server - mysql

I have an MVC 5 application that I first configured to use Mysql but now would like it to use SQL Server.
My app uses code first and migrations in order to generate the database.
After I changed all the required configuration I tried to run a Update-Database from the Package management console but I keep getting this error:
System.Data.Entity.Core.MetadataException: Schema specified is not
valid. Errors: (0,0) : error 0152: No Entity Framework provider found
for the ADO.NET provider with invariant name 'MySql.Data.MySqlClient'.
Make sure the provider is registered in the 'entityFramework' section
of the application config file. See
http://go.microsoft.com/fwlink/?LinkId=260882 for more information.
This error appears after the database is created. It also appears when I run the application since it checks at that moment if there is any migration to do.
Somehow it still tries to use MySQL even though all providers point to SQL Server.
Any help would be more than welcome.
Thanks in advance

You need to follow the below mentioned steps to overcome above issue.
Step 1 : Use NuGet package to remove and install the relevant packages.This is very important.
If it's not working after the above step then you have to follow the below mentioned steps.
Step 1 : Get a backup of your project and SQL db and keep it in a safe place.
Step 2 : After that you have to delete all your data migration scripts on your app.
Step 3 : Delete the SQL db also.
Step 4 : Recreate all your Migration scripts again and after that run those against the SQL server.
Note : You need to do above steps b'cos it seems EF keep the provider details on the db migration scripts.

Related

SQL Server 2019 - Job (SSIS) fails with error "The system cannot find the file specified"

I am currently migrating a database from an old SQL Server 2012 to a new system running SQL Server 2019. In addition to the database I am also migrating several SQL Server Agent Jobs.
One of these jobs consists of multiple different steps, one that just runs a PowerShell script and two other steps that are implemented as an SSIS package. When I execute one of the steps that are implemented as SSIS package, I get the following error:
The process could not be created for step 2 of job <long hexadecimal number> (reason: The system cannot find the file specified). The step failed.
How am I supposed to diagnose this error? I have no idea which file cannot be found and why. Is there no way to get any additional information about this error? I already checked all files involved in the SSIS package such as the package file itself, the configuration file and all files that are accessed during the execution of the step but I cannot find the reason for this error.
Could there be a compatibility issue since the packages are executed in a new SQL Server 2019 instead of the older SQL Server 2012? If so, how can I check if this is actually the case?
Thanks a lot in advance!
Having the exact same issue.
Found a workaround, don't like it, but it did get the package run.
Change "Type" from SQL Server Integration Services Package" to "Transact-SQL script (T-SQL)"
Make your SQL Statement something like:
EXEC xp_cmdshell '""C:\Program Files\Microsoft SQL Server\150\DTS\Binn\DTExec.exe" /FILE "\"<Path To Package>\<PackageName>.dtsx\"" /WARNASERROR /X86 /CHECKPOINTING OFF /REPORTING E'
Note that the start of the command '"" is NOT a type-o, neither is the \"" right after the .dtsx package name.
Don't like this answer, but until the correct solution comes along... it is working.

Spring Boot Jdbc Flyway Version File Name "V1__script.sql" not working instead renaming file with "V1_file.sql" is working

I have tried flyway(5.2.3) with Spring boot(2.1.0-Release) for MySQL (5.7) without JPA,
When I tried to run the Spring boot project the flyway version script file with the name "V1__script.sql" is only creating one table and it throws exception SQL Syntax error for the second table with local MySQL version.
If I have created the multiple files with V1__script.sql, V2__script.sql, V3__script.sql by having a single table script in it that is also working fine.
Version details :
Flyway: 5.2.3
Spring Boot: 2.1.0-Release
MySQL: 5.7
But when I renamed the file from "V1__file.sql" that works fine without any error.
Is there anything that I missed in the configuration. Is Flyway is not supporting "script" word in script file name?
Thank you.
Multiple statements are allowed in the sql script used by FlyWay. However it should be correct sql statements. Make sure you finished the lines with an semicolon(;)
The best test for a correct file is running it with something else. If you can import the file using mysql options table < V1__file.sql then FlyWay should work also.
If you rename the file to V1_file.sql it will be ignored by FlyWay.

Error in setting up icinga_web. Table doesn't exist

I'm trying to setup icinga-web interface for monitoring servers. I have it installed and done with all troubleshooting mentioned here -
https://wiki.icinga.org/display/testing/Icinga+Web+Testing
But, I'm getting this error while accessing icinga-web interface -
Uncaught Doctrine_Connection_Mysql_Exception thrown:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'icinga_web.nsm_session' doesn't exist
Looking into databases, nsm_session table is present in "icinga" database and not "icinga_web". Is there any configuration that I am missing? Thanks in advance for help!
Likely you mixed your database setup.
'icinga' is the default database for the idoutils database backend, letting icinga config/status/historical write into it
'icinga_web' is a seperate database (and schema) which is only for icinga web's session, internal auth, etc information
It seems that the icinga_web db schema was imported into the 'icinga' database, and now the default settings of your icinga web installation point to the incorrect location.
There's two possibilities here:
clean the 'icinga' database from the faulty tables (look into icinga-web-src/etc/schema/mysql.sql to see which tables are created) and create the database 'icinga_web' and import the schema (see the docs on how to achieve that)
or work with the existing 'icinga' database, but update your icinga web databases.xml configuration - the dsn part for the icinga_web parts must bei changed to select the correct database 'icinga' then. http://docs.icinga.org/latest/en/icinga-web-config.html#configweb-databases
I would go with the clean and seperate way, makes debugging and resolving errors easier, so 1)
note: if you did install via package manager, i.e. apt, run "dpkg-reconfigure " for invoke the database configuration assistant.

Team Foundation Server TFSConfig recover

When trying to restore my backuped TFSCollection via Administration Console (attach collection) the attachment fails. (NullReference Exception)
Are there any problems when restoring collections without the original configuration database?
The Collections is listed, but state doesn`t change from "offline", even when i tried to re-run the job.
When looking into [TFSCollection].[tbl_projects] via Management Studio I can see all projects.
When trying to restore the collection via
TFSConfig RegisterDB /sqlInstance:DataCenter\MSSQLServer /databaseName:DataCenter\MSSQLServer;Tfs_Configuration
I get the following error:
The following exception was caught while trying to validate the database: Keyword not supported: 'tfs_configuration;integrated security'.
Or when i run:
TFSConfig recover /ConfigurationDB:DataCenter\MSSQLServer;Tfs_Configuration /CollectionDB:DataCenter\MSSQLServer;Tfs_TFSCollection
The following error occurs:
TF246017: Team Foundation Server could not connect to the database. Verify that
the server that is hosting the database is operational, and that network problem
s are not blocking communication with the server.
Maybe I´ve run into some serious problem when installing TFS Service Pack 1.
What could i do to restore my TFS?
Even the import in my virtual enviroment fails. See the logfile.
If anyone had the same problem, take a look at http://support.microsoft.com/kb/2516423.
If you cant access your collections you could try.
TfsConfig updates /reapply
To start the TFS Job Agent you can run.
TfsServiceControl unquiesce
Or if the "Serviving" State doesnt change you could try this.
TfsConfig diagnose /scope:updates
TfsConfig updates /reapply
Hope this could help..

Unable to initialize provider. Missing or incorrect schema

I have upgraded my server machine to use MySQL Connector 6.3.4 and in our website we also added Membership role provider.
When I run the website I am getting this error.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Unable to initialize provider. Missing or incorrect schema.
My sql server is version 5.0.90 community-net.
Is there any setting which have to be changes on server side while upgrading connector
This is tag in my web.config file.
Since when I run the website on local machine it will run successfully, but on server I am not able to run it and getting above error.
There is no mistake in connection string
What are server side setting which we to do while upgrading the connector....
thanks
I myself running into the same problem. I m using Mysql connector 6.3.0.0
So far I came across following suggestions when seaching on net:
1) Add "MySql.Data.dll" & "MySql.Web.dll" into your application "bin" folder.
2) Add reference to above to dlls in your application .
3) Add autogenerateschema="true" in your web.config file for required sections.
4) Check your Mysql connector version - make sure that the one that is in your bin folder is mentioned in your web.config file.
5) Check your connection string - make sure it is correct and connected successfully.
6) Check mysql membership related table structure.
7) Check schema version in "my_aspnet_schemaversion" table (e.g since you have upgraded to newer version I insist you should check this).
8) If the problem is on remote machine (e.g Production Server) you may wan to check this : http://www.reggieburnett.com/referencing-connectornet-on-a-remote-machine
I m sure you may gone through this list but I would like you to check schema version in "my_aspnet_schemaversion" table (e.g compare "version" field value of your local and remote table) since your upgrading to newer version.
BTW: I have checked this list for my problem but it did not help. I hope it may be of some help to you.
Edit:
Hi,
We are able to fix this error by following:
1) Deleted the tables for memberships in the db and had the mysql membership provider regenerate them
2) than set the Aministration.config file to trust the Mysql Membership Provider (e.g related to IIS admin)
Regards,
Gaurav
I had this same problem after checking all the things in Gaurav's post. It ended up being that the user account I was using in my connection string did not have necessary permissions to alter the db schema (I had autogenerateschema set to true). Once I changed my connection string to a user with more privileges (I used the 'root' user) then it updated the schema, and I changed the connection string back to the original user.
Always make sure that the Datasource is set to the real ip address and not localhost and check the passwords and usernames too. I am working with these clients and their ip address keeps changing and every time they do that, I get the same error
I know this is an old thread but maybe this will help someone. I was having this issue and realized that I was editing the wrong machine.config
At first I was editing on under C:\Windows\Microsoft.NET\Framework64....
Once I found the one for my .NET version under C:\Windows\Microsoft.NET\Framework.... and edited the correct spots, it worked fine following the instructions on MySQL's site.