0

I have a java application that I programmed, and I also created a Wampserver database to store the app's data. When I install the application in another computer, it basically can't do anything because wampserver isn't installed on that computer, and even if it was, the database wouldn't be imported on that same computer.

Can I install the database with the program itself, without making a database server in my computer? (For security reasons)

Sorry if this is a dumb question, im new to programming.

In Yumen
  • 31
  • 7
  • Possible duplicate of [grant remote access of MySQL database from any IP address](https://stackoverflow.com/questions/8348506/grant-remote-access-of-mysql-database-from-any-ip-address) – Phil Aug 06 '18 at 01:25

3 Answers3

0

You can open your MySQL server to the outside world or to certain IP (comment or edit bind value in your MySQL configuration file).

This can be a security issue. What is your objective? Usually, you'd do an API allowing access to your data from your application.

Mtxz
  • 3,749
  • 15
  • 29
0

You are talking about "hosting" your database. You need to either:

  • Create, develop, and run a hosting service (not trivial), or
  • Pay to one the myriad of hosting services available, and install your database there (cheap these days). Just a couple of well known examples: Digital Ocean or Amazon Web Services.

In any case, it's a huge security risk to open your database to any client online.

Normally you write a program/application that accesses the database in the same [local] network, and that application serves web pages (or other web service) to the world.

The Impaler
  • 45,731
  • 9
  • 39
  • 76
0

Assuming you are doing this in a Home/office environment. Where your IP Addresses do not change so often. Or you have the power to assign them statically.

You could try using a multi-threaded client server model. Where your wampserver computer(server) will accept a connection from another computer(client), and from there any queries to the database will be handled by that thread. This way, you could get away without installing wampserver on every client.

It would require some networking codes to be added to your java program. There are many examples on multi-threaded client server model -> Multithreading with client server program

Matt
  • 76
  • 1
  • 10
  • That won't make me have security issues? As I am the principal server and everyone that uses de program is using my computer basically? And also, when I shut my computer the clients can still work on the application, right? – In Yumen Aug 06 '18 at 12:33
  • That's not how a server works, if you shut down the server then no one can connect. If you want to shut down your computer whilst the rest connects to the database, you are looking at hosting an internal server. And it could be somethings like a rasberry pi project. Where you can leave it running and connected to your intranet, saving cost over the long run compared to a regular pc – Matt Aug 06 '18 at 16:23
  • Is there any other way? Like installing the database with the program itself with a setup installer or something? – In Yumen Aug 06 '18 at 19:21
  • You could do that, but that means if you have X no of PC, then you will have X no of running database with X variations of updates. Making your database inaccurate X times. My recommendation is to host 1. Host on a server 2. Host it on a Network Accessed Storage(NAS), which can be linked to your home router. (Put your database onto a HDD, connect to the router & share it via IP address) – Matt Aug 07 '18 at 17:12