Click here to Skip to main content
14,038,887 members
Rate this:
 
Please Sign up or sign in to vote.
I have developed application which mainly uses sql databases to store and save data. My problem is, the application works well in my machine because MySQL Workbench installed locally in my machine and no problem with connections between the application and my sql. However once I installed the application in another computer, I can not work and am always getting (Unhandled exception has occurred in your application). I know that the problem is because of missing databases and sql in the second machine.

My question is: How can i use my applications in any machine without building the databse and its table every time in the new machine? is it possible to export sql databse and use it sepearately from MySQL workbench? By other words, is there any way which can make my application works well in any computer by using sql databse files in my application and make my software independent from MySQL workbench

What I have tried:

The problem can be solved; if I installed MySQL workbench in the second computer and setup the tables of database. each time should I do like this procedure.
How can I use the databses files in my application which can make the application useable in any software without installing MySQL each time.
Posted
Updated 27-Jan-19 23:02pm
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

MySQL is a multiuser database - which means it is installed on a server, and various client applications (such as yours) connect to it and they all access the same database.
This is fine, but it requires a substantial investment on a single computer to support the DB server, and it requires new databases to be constructed on that server by MySQL before any of the clients can access them.

And that's what you are doing when you install Workbench - installing MySQL on a local machine to use it in your app.

Which isn't the idea at all - if you want multiple copies of a DB so each user has his own, then use a single user DB such as SQLite, or Access - dont; use MySql or SQL Server at all as they are "heavyweight" solutions designed for multiple users and require substantial investment from the client which is not likely to be popular.
For example, if your app came to me and insisted on installing MySQL it would get deleted post haste: I already run SQL Server locally for dev and don;t need another server DB system installed!

If you need multiuser access use a server based DB, and make the client having a working installation a precondition of your installer. If you don't, use a single user DB which has a much smaller footprint, and just include the required DLL files with your app.
   
Comments
Member 13967559 28-Jan-19 3:36am
   
Thanks very much for your solution,
If I want to fix MySQL workbench in one computer and install my application in multiple computers,

should I change in this part of code? do you know where exactly should I change ?

String^ constring = L"datasource=localhost;port=3306;username=root;password=123*;Persist Security Info=True;database=studentsgradesystem;Convert Zero Datetime=True";
OriginalGriff 28-Jan-19 3:55am
   
You'd certainly have to change that - and I'd strongly suggest a configuration file instead of a hardwired string - but exactly what you change it to would depend on the local environment and how (and where!) MySQL was installed and configured. We couldn't tell you what the string should be because it will be potentially different for each installation - hence the config file!

But ... using root access is a BIG no-no! You should only use that to configure MySQL and set up user accounts - then you use a user account that only has exactly the permissions it needs for your app to do it's job.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Here is an overview of lightweight databases, with their pros and cons:
https://www.slant.co/topics/69/~best-lightweight-databases[^]
   
Comments
Member 13967559 28-Jan-19 5:33am
   
Thanks very much, I found, it is very helpful

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web05 | 2.8.190425.1 | Last Updated 28 Jan 2019
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100