I've been trying to connect to a MySQL database which is hosted on a RaspberryPI and I have been having a lot of trouble and wanted to know if it is possible before I continue.
I want to use .Net's Entity Framework 6 on Visual Studio 2013 in the same fashion as you would SQL Server to create Entites from the Database. First of all is this possible?
I have had two problems so far:
Firstly, I have been able to connect to a MySQL database on my local copy but not the Raspberry Pi's even though I have a user which allows any IP and has most privileges (I am connecting through LAN).
My Second problem is that once I have accessed and picked a database I receive this error, which makes me think that Entity Framework doesn't support MySQL:
I am also having a problem logging into my local instance of MySQL when the user has a password, which makes me think this could also be why I can't login to the remote MySQL?
You'll have to use an EF Provider to use MySQL and Entity Framework together. Some older Providers don't work with EF at all, or only previous versions.
Connector.NET is the 'official' solution: http://dev.mysql.com/doc/connector-net/en/connector-net-entityframework60.html
There is also some tooling from Devart (DotConnect) that may work 'better' than the MySQL Connector.NET. The reason I say that is in my experience Oracle's EF Provider (For Oracle) was not nearly as easy to set up / maintain as the Devart Solution.
Related
I am working on a Winforms application in C# using .NET 6.0.
The application has a SQL Server database with four tables. I have completed it and created setup.exe which successfully installs the application on my computer and works perfectly with the SQL Server Express database.
However, when I install it on another computer, I have problem to establish and connect database. I followed several instructions with no success. I even changed platform to .NET Framework 4.8 and followed tutorial to create localDb.
It works fine if I have only one table and one form with datagridview which follows table from database. But when I try interaction with other forms and tables it does not work.
It seems to me that only way is to install SQL Server Express on another computer and create the same connection string and same table, which I believe could not be the truth.
I saw a number of questions addressing the same problem, but there is no answers that solve it. I would be very thankful If anybody could suggest tutorial or article which addresses this topic.
Are the ProviderManifests used by EntityFramework backwards compatible, in particular for Oracle and SQL Server?
I'm creating an instance of the DbProviderInfo class to pass to DbModel.Build(). The second argument to the constructor is the ProviderManifestToken.
As the documentation says, the ProviderManifestToken is:
A string that identifies that version of the database server being
used. For example, the SQL Server provider uses the string "2008" for
SQL Server 2008. This cannot be null but may be empty.
There is a related, unanswered question here asking what ProviderManifestInfo does. From reading this page I understand that it allows the database provider to determine which version of the ProviderManifest to return, without using a database connection. (What the ProviderManifest does is also explained at that last link.)
Experimentally, I have found that I can use an Oracle 12 database with a ProviderManifestToken of "11.2" with no problems. But is this supposed to be true in general? For example, if I pass "2008" as the ProviderManifestToken and I am using SQL Server 2012, can I expect 'things' to work OK?
I have been unable to find any documentation on this point and I would not be surprised if things are different from provider to provider.
But is this supposed to be true in general? For example, if I pass "2008" as the ProviderManifestToken and I am using SQL Server 2012, can I expect 'things' to work OK?
Yes, subject to the backwards-compatibility of the database provider. Oracle and SQL Server, at least, are very reluctant to break existing applications in new versions of the database, so applications written for older versions typically work fine.
The main purpose pf the ProviderManifestToken is to allow EF to use new functionality for a database provider, without abandoning support for old versions. For instance SQL Server introduced OFFSET .. FETCH paging in SQL 2012. And without the ProviderManifestToken EF would have to choose between using the older query form for paging (ROW_NUMBER() based), or drop support for SQL 2008.
It is possible that EF would generate a query that doesn't work correctly on a later version, which would be a bug in EF. But I don't know of any such cases.
I need your help to answer a question.
I coded a basic c# portable exe application that uses an Access Database on a server computer. On the network there are some client computers that runs this application and retrieve and store data via this database placed on the server computer in a shared folder. Every client coputer can access my database with this connection string:
#"Provider=Microsoft.ACE.OLEDB.12.0;Data Source =\\ANKFILESERVER1\aractakip\DatabaseAd.accdb
So far, there has been no problem. But as known, Access (Oledb) database has a limited capacity to save datas and since i'm worrying that someone change or delete my database files -authenticated for everyone- i decieded to use another database platform like postgresql.
My question is, if i install postgresql on the server computer and migrate my database tables, Are every client computers needed to install postgresql to access my database tables? If yes, what should be my connection string?
Thanks in advance.
You will need a client driver - like psqlODBC - installed on each computer that connects to PostgreSQL via MS Access, yes.
You can install psqlODBC separately, or using the main PostgreSQL installer. The separate psqlODBC-only installer is an msi that can be deployed over Active Directory, making management easier.
The connection options are covered in the psqlODBC documentation.
Microsoft Access is really written for the Microsoft JET / OLEDB engine, and to communicate with Microsoft SQL Server. It works with PostgreSQL, but it doesn't fully "understand" all PostgreSQL's features. It also does some things in totally non-SQL-standard ways that work on MS SQL but do not work on PostgreSQL. So it can be awkward to use MS Access with PostgreSQL due to things like Access not really supporting SEQUENCEs properly. Note, though, that I haven't used Access since Office 2008, so things may have improved.
I have a C# application in .net 3.5 using SQL Server 2008 R2.
I am using ado.net Entity Framework to generate the database but after generating it when I remove the database file from SQL Server the framework does not generate the database.
I want to generate database on users local machine while installation and have a password on database access and protect the data from being read or modified by a local user rather than my application.
So the question is how to achieve this with out encrypting the whole data?
What is the parallels here?
I don't think EF in .NET 3.5 was ever capable of creating a database at runtime.
You'll have to either upgrade to .NET 4 and EF 5 or 6 to use code-first with migrations to handle this, or then you need to write some code to handle that situation yourself, in .NET 3.5.
Also: a SQL Server database (file) doesn't have a password mechanism like Access or other file-based system do. Access to a SQL Server database is handled by the SQL Server itself by means of logins on the server, users on the database-level and permissions for those users.
I'm working on a Windows Forms application in VS 2013 that requires saving data. I can't find a good solution for this, since:
A SQL Server database will work fine, but it will force the user
to have SQL Server installed on their computer.
The same applies to Access or Oracle DB.
DataSets require a database connection,which leads me to 1) and 3).
Text/XML files don't satisfy the
security requirements and will seem like a very primitive solution.
So , in essence, when the user installs the application, on its
first deployment it must create a database and keep it for future
access, without requiring the user to have any special programs
installed (e.g. SQL Server). I apologize if this question seems
stupid.
This is in two parts - how to create a database application and how to access it for initialisation.
Option 1 - if you can resolve the problem of installing SQL Lite/compact using the suggestions above then you can use Entity Framework with code first to create the database and tables. There are plenty of examples only a Google search away.
Option 2 - create an Access database (an MDB or ACCDB file) with blank/empty tables and deploy this as part of your application. You can the access this with a suitable connection string - again, Google will solve that one.
Use SQL Compact Edition .
Using LINQ to SQL you can create a Database/Tables for the first time deployment.
Please Refer the Link http://msdn.microsoft.com/en-us/library/bb399420(v=vs.110).aspx