-4

MySQL, for example, does not require this. Why MongoDB does?

The problem: I'm writing an app (for PC) in Java that uses MongoDB. I downloaded a driver (3rd version, the newest) and everything is fine... ...except for the need to launch mongod.exe to actually use a database.

In terms of app, it is extremely user-unfriendly. So in order to use my app, he will need to launch mongod.exe first, and even if it's done automatically by my app (via using runtime), user will still have 2 windows.

Moreover, instead of seeing just my app icon on taskbar.

How it should be:

how it should be

User will see my app icon and mongod icon:

How it is:

how it is

Is there any solution to that? If not, can somebody explain why do we need to start mongod at all? It's very poor design from MongoDB devs, for example when using MySQL your Java app can connect to databases directly, without running any other software that is displayed on taskbar.

If apps that use MongoDB will require from user to launch mongod beforehand, or even if they do it themselves but there are 2 icons on the taskbar and that large black window of mongod running, it would be totally unfriendly to user so there would be no sense to use Mongo.

Bista
  • 7,869
  • 3
  • 27
  • 55
doe
  • 29
  • 3
  • 3
    Why Windows need the power cord of my PC plugged? – thepirat000 Dec 03 '16 at 04:57
  • Because your third party app is just a java wrapper around mongodb and will translate the queries you write in java to mongo format and pass it to mongod. – Mohammad Yusuf Dec 03 '16 at 04:58
  • Add the 'java' and 'mysql' tags to this for better community visibility. – T-Heron Dec 03 '16 at 05:06
  • @thepirat000 well suppose you have 2 windows pcs and one of them is running perfectly without a power cord. A question like "then why the second one does need it?" is very logical. Here's the same case: why MySQL doesn't require from me to run its server explicitly, whereas mongodb does? I didn't know MySQL is running as a service, that was an answer to my question. – doe Dec 04 '16 at 23:03
  • Possible duplicate of [MongoDB on a Windows 7 machine: No connection could be made](https://stackoverflow.com/questions/23726684/mongodb-on-a-windows-7-machine-no-connection-could-be-made) – Pawel Gumiela Dec 16 '18 at 23:32

1 Answers1

4

Mongod is mongoDB server application! without running it there's nothing back there listening to your requests!

Regarding to MySQL, you probably set it as a windows service and windows automatically runs mysqld.exe at windows start up! otherwise you would need to run mysqld.exe too!

  • 1
    I don't see it in running services list though (i mean mysql or mysqld). Anyway, it would be a really bad app design if there's 2 icons (and windows) instead of one. Is there any way to launch mongod without its console and taskbar icon being visible to user? – doe Dec 03 '16 at 05:03
  • yeah! run it as a windows service: [check this](http://stackoverflow.com/a/2438758/2586595) – Mohsen ZareZardeyni Dec 03 '16 at 05:08
  • 1
    Exactly, MySQL runs as a windows service. Check the running services and you will find there. Second both MongoDB and MySQL are never designed to be embedded on a client application. You are heading in a wrong direction. If you want to store some data on the client-side use something like sql-light or derby-db – Aboodz Dec 03 '16 at 11:51
  • @Aboodz thank you, I get it. But why is using Mongo or MySQL on a client app is a wrong way? When I learned SQL in college (well I'm still a student) we made a small programs using MySQL, they were all client apps. Why is it a wrong approach? – doe Dec 04 '16 at 23:00
  • Because they are very heavy (MySQL is around 140MB while idle) + not portable. However, it is really fine to use it for learning and development. I use it personally. – Aboodz Dec 05 '16 at 08:34