0

I am wondering if it is possible to create Spring project that uses hibernate with MySQL on a computer that does not have MySQL installed. I know it is possible to run Spring project as a jar with just java installed, but can I run spring project that accesses a database without the database installed?

Quillion
  • 6,346
  • 11
  • 60
  • 97
  • 2
    Of course it's possible. All you need is the JDBC driver in the classpath, talking to the database over the network. Of course, you need MySQL installed somewhere on the network. How could you save anything in a MySQL database without a MySQL database? – JB Nizet Oct 28 '17 at 17:33
  • When I run spring-boot it installs the server and runs spring on it, this way the machine doesn't need to have a server configured, I was wondering if it is possible to have a machine without MySQL configured. Can I use something like NoSQL? – Quillion Oct 28 '17 at 17:40
  • Plenty of embedded databases you can use. H2, HSQLDB, Derby – Oleg Oct 28 '17 at 17:44
  • It doesn't really install anything. It just starts an embedded web container. NoSQL is just a vague word to refer to a whole lot of non-relational databases. Sure, you can use one of those databases. But being a NoSQL database doesn't mean you don't need to be installed. Maybe what you're looking for is an **embedded** database. Yes, those exist, too, including relational ones. Spring Boot uses one of them *by default* if you don't specify a datasource. MySQL is not such an embedded database, though. – JB Nizet Oct 28 '17 at 17:44
  • Any links on how to use them? Which one is the best one? I will accept it as an answer if you respond to this question as an answer – Quillion Oct 28 '17 at 17:46
  • 1
    Why don't you read the official Spring Boot documentation? https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-embedded-database-support – JB Nizet Oct 28 '17 at 17:51
  • 1
    As for embedded databases engines for java - it was discussed here https://stackoverflow.com/questions/462923/java-embedded-databases-comparison – Evgeny Semionov Oct 28 '17 at 19:26
  • Docker springs to mind if you really want to use MySQL instead of an embedded db. – Yoshua Nahar Oct 29 '17 at 09:06

0 Answers0