I am building an application which needs to connect to a central MySQL database. The application is written in C#. I have installed the .NET connector from MySQL for the VS integration.
I was wondering if there is anything special I need to do to be able to have my application be portable and not require an install of the connector on every machine it is used on?
There is a similar question I found here on SO, but it is for a server instead instead of client which is very different.
Edit:
Connector I used: .NET connector 6.2.3 (
http://www.mysql.com/downloads/connector/net/)
When you make an installer, you can include the dll for the mysql connecter such that it is copied along with the other side. This way, whenever the application is installed properly, you wont have the problem.
Related
I have create a Windows application in WPF using Visual Studio 2013, and I'm using MySQL as database, now I want to include MySQL as a distributable package in my setup file.
I am new to development and have very little idea about deploying the software, and i have been searching over the internet but hardly finds any good article which explains the steps to perform the task.
A MySQL database is supposed to be setup on a (remote) database server that the client applications connect to. You don't (or at least you shouldn't) set up a server on each workstation where your client application is installed on.
What you probably want is a self-contained database that can be shipped with your application and run "as-is" without any remote servers or specific setup.
SQLite is a popular example of such a database.
Getting started with SQLite in C#: http://blog.tigrangasparian.com/2012/02/09/getting-started-with-sqlite-in-c-part-one/
Use this:
https://marketplace.visualstudio.com/items?itemName=UnniRavindranathan-MSFT.MicrosoftVisualStudio2013InstallerProjects
And then follow this:
http://geekswithblogs.net/TarunArora/archive/2014/04/24/visual-studio-2013-installer-projects-ndash-hello-world-installer.aspx
There will be settings which you will be setting when creating installer with the wizard, one will be like pre-requisites for the program and will ask you for a MSI location for that program. Dump the location of your LocalDB or whatever MySQL software that you are using (Popular ones are SQLite/SQL Server Express). When the user starts to install the program it will make them install your SQL prerequisite software before moving onto installing your program.
I was with the choice of SQLite as database for easy distribution of my offline c# desktop application (WPF / Winforms) but currently cornered to MySQL database due to IRD certification.
My main concern is that I want to know If I could use MySQL database for offline desktop application and distribute .exe via URL for easy unattended installation.
Is it possible?
As shown on SQLite's page Appropriate Uses For SQLite, a client/server database like MySQL would work better for client/server applications, high-volume websites, very large datasets, or high concurrency. Nothing of this applies to your offline application, so you should use a database that was designed to be embedded (not necessarily SQLite).
MySQL has an embedded server library which can be linked directly into an application. When using C#, the MySQL library is linked into the .NET MySQL database driver, so using the embedded server would require recompiling this driver. And such linking will trigger MySQL's GPL license. And:
The libmysqld embedded server library is deprecated as of MySQL 5.7.17 and will be removed in MySQL 8.0.
It would be possible to install the standalone MySQL server yourself; this is described in Installing MySQL on Microsoft Windows Using a noinstall Zip Archive.
However, this would still run the MySQL server as a separate process or service, and this could conflict with other installations on the machine; it would be your installer's responsibility to configure that MySQL instance correctly for whatever environment it encounters on the target machine.
I know this looks like the same issue in 2041051 but I have a different question.
I have a C# app that uses MySQL 5.5. It's built using MySQL Connector .Net 6.5.4.0 (which came with MySQL 5.5). Everything works fine running on my computer. When the app is run on a computer that has MySQL 5.6 installed, the app fails with the error shown in the title above. I think MySQL 5.6 installs Connector 6.6.5. So it seems I have a couple options:
1) Add an explicit reference to the 6.5.4.0 connector, make it Copy Local, and distribute it along with my app.
2) Make my app somehow insensitive to the specific version of the connector. I have no idea how to do that, or if it's even possible.
3) ?
Do I understand the problem correctly? What's the best solution?
i found that its really pain to create setup and deployment packages for windows xp/vista/7
so my question is can i make my application portable with any third party tool such as thin app ?
my application requires dot net 3.5 framework and sql express 05 installed i want to put it on usb drive and user can execute it directly from usb drive without any setup and deployment, if there any other ways to achieve portability for software please let me know?
thanks !
In order to check if .Net 3.5 and sql express is installed you can check if they are registred in the registry.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\CurrentVersion - CurrentVersion
But you cannot check this with your 3.5 compiled assembly, so you need a non-dotnet application to do it, like a setup program.
Either you have to create a launcher in something like c++, or you could create a vb script launcher which checks the prerequisites before launching your .net app.
Neither SQL Express nor the .NET Framework will not run without being installed on the local hard disk.
Source for SQL Express: http://social.msdn.microsoft.com/Forums/en-US/sqlsetupandupgrade/thread/fc729d31-8a0b-4156-ab75-4fec652a438b.
#Mikael already told the trick for .NET detection which you should take a look at.
I just want to add that for portable applications, you should use SQL Server Compact edition instead of Express,
Link
I am using System.data.odbc with "Driver={MySQL ODBC 5.1 Driver}" in the connection string. However, I have not realised there is MySQL connector installed on my PC so however I have not referenced it, it doesn work without it.
Now I need to distribute it embed in the app. I have downloaded MySQL Connector/ODBC 5.1 files, but with Add reference it says "The file is not accessible...make sure its valid COM.." etc.
Thank you
MySQL Connector/ODBC is, as the name suggests, just an ODBC driver for connecting to MySQL. It's not specifically designed for .NET and you can't embed it in your .NET applications in any way. It will need separate installation on any machine where you need to use it.
MySQL Connector/Net is a fully managed ADO.NET provider for MySQL. It's tailor-made for .NET and doesn't require the installation of any other software. It's easy to reference and distribute in your .NET applications, you'll just need to use the System.Data.MySqlClient namespace and objects rather than System.Data.Odbc.
You can embed the .NET DLL, but not the driver itself. You'll need to install MySQL Connector on every computer that runs your application.
The only thing u need is Mysql.Data.Dll
You don't need to install the complete connector, everything u need is in there.
That also counts for the end user, they also only need the dll