Connect to MySQL server without MySQL on local computer - c#

First, excuse me if I don't use the exact terms (I may do some mistakes using terms).
I am working on one program that I develop on my personal computer.
For MySQL, I installed WampServer, so I can connect to my MySQL database (on computer).
My program will be installed on CNC machines in a workshop, without possibility to install any MySQL tool (old machines).
What I am wondering is, if I make a program using MySQL library (MySQL.Data.dll), will the program be able to connect on MySQL DataBase located on the server (of course with connection to the server).
I have no experience on that point, and that's only now I am thinking about this possible issue. Any advise will be welcome.

Related

Using C# application with Mysql Database on Another Computer

I have made a C# application MySql Database attached I am going to use the Application on a different Computer. According to my Logic. The Mysql database is running on the localhost server of my first PC and I think that the localhost of the other PC will be different. So,My application Won't connect to the server - It's my Idea which may be wrong.
I have the following Questions :-
1.
How do I make a Mysql local server that will even work on another PC.
2.
Do I have to Install MySql on other PC ? If yes How can i include mysql setup in the Setup Wizard of my app.
3.
Do I have to make changes In the Code (Connection or anything).
Please Give any extra suggestion if you have about this.
You do not need to install mySQL on the computer that will have the app. that defeats the purpose of having a SQL Server
You will only need to change the connection string so instead of connecting to Localhost or 127.0.0.1 you will use the ip address of the machine that has the server installed. Connection Strings
I suggest you do some reading about networking, design patterns, and SQL or you risk building a very insecure application.

C# connect to MSSQL .mdf DB without Server

How can I ran x86 .net 3.5 Windows Forms app with .mdf database on the computer without SQL Server (for example, XP of common user).
I have found few samples of connection strings, but all of them are contains something like Data Source=.\SQLEXPRESS
Doubt, that user will be having SQLEXPRESS on his computer. I want something like work with Access db - so user could work without even knowing, what's server, only with local file
MSSQL I have chosen instead of Access, because in the future I can add publish DB on server, but not now.
Maybe, I should use SQLLite, but how in that case?
Thanks.
How can I ran x86 .net 3.5 Windows Forms app with .mdf database on the computer without SQL Server?
This question has very simple answer - you can't!
You must distribute and install some version/edition of SQL Server with your application, otherwise the .mdf file will be nothing more than waste of disk space. You can install SQL Server along with your app. For more information you can see Install SQL Server from the Command Prompt and Install SQL Server using a configuration file. If this is a simple app working locally on a single workstation, you may want to consider using SQL Server Express LocalDB.
Another option is to use different database engine, which has easier deployment and embedding - SQLite, Firebird Embedded, etc. Pick one that you like. Most of these solutions require only to distribute one DLL/assembly with your application. You will not get the full power of SQL Server, but for most apps, it isn't needed anyway.

Connect to LocalDB of other system [duplicate]

I am looking into using the new SQL Server Express LocalDB (I think it is code named "Denali") for a desktop application.
It is currently running with SQL Compact, but the user is wanting to share the database between multiple PCs on a network. Unfortunately this is not something that SQL Compact can do, so I am investigating other solutions.
The client requires the ability to send database files easily to other sites or to back them up to a flash disk, so I am avoiding going to SQL Express because there is quite a bit of "administrator" knowledge required to backup and restore.
So, my questions is, does the new SQL Express LocalDB support remote connections to the database over a network and/or through a shared network folder with the mdf file in it?
LocalDB does support supplying a path for an attached local DB in it's connect string (AttachDbFileName) hence the shared network folder option.
NOTE: This question pertains to "LocalDB" the new version of SQL Express 'Denali' and not to SQL Server Express 2008 or prior.
See article here announcing LocalDB's release: http://blogs.msdn.com/b/sqlexpress/archive/2011/07/12/introducing-localdb-a-better-sql-express.aspx
No, SQL Server Express LocalDB doesn't accept remote connections.
The idea with shared network folder might work, but only if you are able to make sure the LocalDB instance is shutdown before you try to copy the file. Also keep in mind that only one LocalDB instance can have any given database file open at the same time. and don't forget about the log files!
Additional security warning: unlike SQL Server Compact databases, SQL Server Express databases (including LocalDB ones) are not designed as secure data exchange format. For instance, they can contain malicious code in .NET assemblies embedded in them. So you should never open databases from untrusted source.
Maybe providing the customer with a simple tool that automates the backup process would be a better idea?
This isn't a fresh thread, but I would like to share my experience with SQL Server Express database LocalDB.
I have a WPF C# project using SQL database with LocalDb Engine. It is working fine no problem, I can use the database with the WPF app. I wanted this app to work on network with more PCs.
On the network another PC can use the database from my PC using UNC path in the connection string.
It seemed to me the remote connection is working. However when the remote PC is connected, I am not able to use the database with my local WPF app. If I run my app first the remote PC could not connect. So this tells me that the remote connection is working, but the multiple connection is not allowed.
OK, I didn't give up and I run the app from my PC twice and I saw it is working which tells me that the same SQL LocalDB engine can handle multiple connections locally only.
I hope this experience will help someone. Thanks.
In short, yes it can. Here is a tutorial on how to configure it.
Also, here is another post with a potential issue that might occur.
Both explain how to configure SQL Server Express to accept Remote Connections.

What I have to have for running sqlserver?

I have a simple code that is using C# and Sqlserver 2008.
For my C# code I get the .EXE file to customer and forced to install the .NET framework on her computer to run just the C# code.
But about the Sqlserver; I have installed the complete Sqlserver on my PC then attached my database on management part of that and am using the Sqlserver
now that I want to get my program to customer I install the .NET framework; but how can I run Sqlserver on her computer and attach the database each time?
Lets me to explain more:
The program will use on a local network and is multi_user.
I installed and am using the Sqlserver on my PC. I created my database and it's tables by help of sqlserver management tool.
for connecting to the datatbase I wrote a code that connect via the users IP address and I tested it on my PC with 2 Virtual machine. It is working truely.
My problem is here:
When I get the program to customer, what I have to do exactly?
What about the database I have to do?
I have to install the whole Sqlserver on customer PC and set that PC as a server or I have a better way to do this?
Thanks.
If you want to use sql server as an embedded database for local storage, use sql server CE.
If you want your users to have access to a shared database you'll have to instal sql server (sql server express may do) on some machine in their network, configure the access rights, and adjust their connection strings accordingly. Or use SQL Azure.
I have to install the whole Sqlserver on customer PC and set that PC
as a server or I have a better way to do this?
yes you have todo all this work
1)install sql server and the management
2)install your database
3)remote your database to be used

What C# database support multi connections over shared network?

I want to build a simple database program in C# to add,update and remove information.
The program should be on shared network between 3-5 computers and each could add his information in the same time.
I searched and found that SQLite isn't good for that, and don't know what will be.
I'm looking for some simple database, not something that I should install in each PC to support it.
There isn't an access to the internet, its blocked except a few websites so its not possible to use MSSQL or mySQL.
Thank you.
The fact that the users don't have access to the internet doesn't mean that you can't use MySQL or MS SQL Server. You can install MySQL on one of the computers (the one that will play the server role) and have all the other computers connect to the MySQL instance installed on the local server since you say that they will be on an internal network.
As far as Databases go, there are plenty you can use: MySQL, SQL Server, PostgreSQL, etc... Just don't use MsAccess. ;)

Categories