DDD Sample Application - Where's the hsqldb? - java

I downloaded the DDD Sample Application (based on book by Eric Evans) and it uses a hsqldb. However, I can't seem to find how this db is set up. I opened the project in Intellij and everything builds like a charm. But nowhere do I find such a hsqldb... I'm not an experienced Java developer, so I'm probably missing something. Anyone that can answer this for me?

HSQLDB (also called HypersonicDB) is usually used as an embedded SQL database in trivial java apps. You can download it here. It's very simple to set up, and usually works just by having the JAR file in your classpath, the sample app should have the appropriate config.

Related

JDBC and MS SQL Server Driver for Java 9

So, I am trying to set everything up to use MS SQL Server 2017 from IntelliJ IDEA, and so far I've been able to connect the IDE to the Databases (Gotta love DataGrip), I'm able to see the tables and everything:
However, Microsoft hasn't developed a suitable Driver that supports Java 9, other than this.
The thing is, I have no idea how to even try to test what they are working on in that GitHub link; I tried to replicate what you would do to install a Driver for older Java versions (For example, Driver 6.2), but to no avail.
It isn't the Data source config, since if it was that, I wouldn't even be able to see the Employee DB, nor all it's contents. Also, the 'Pepe' table name it's just for testing purposes.
What I'm asking for, is someone who can tell me where or what to do with the .jar files that contain said still-in-development driver, so I can make queries with the JDBC.
The file that Microsoft offered to download and test contains this structure:
target.zip
|
|
|--mssql-jdbc-6.3.6-SNAPSHOT.jre8-preview.jar (For Java 8, I guess)
|--mssql-jdbc-6.3.6-SNAPSHOT.jre9-preview.jar (For Java 9, I guess)
Thanks for any help.
Well, it appears that it was as easy as moving the .jar file to the libraries used by the project.
Since I'm using IntelliJ, all I had to do is follow this perfect guide, select the .jar from Microsoft and works perfectly!
To anyone with similar problems, just download the necessary Driver, move the .jar to the libraries used by your project however you do it with a different IDE, and you're ready.

Spring+Hibernate+MySQL CRUD not working

I wanted to learn how to make a simple Spring+Hibernate+MySQL CRUD.
I found a tutorial. I wanted to run it on my PC first(to check if it's working and then learn what particular lines do). I downloaded the zip file and changed couple of things like name of the package or name of the database, the Spring/Hibernate version and so on.
Unfortunately the program is not working.
Of course there is a possibility that the tutorial is somewhere wrong but I bet that it's me not the tutorial that screwed something up.
If anybody have some free time I will really appreciate any help :)
This is a link to a github repo where I put code.
I use Eclipse and Tomcat 9.
Thank you in advance!
There is a lot easier way to get started with Spring completly from a scratch.
It's called Spring Boot and it is composed of an embedded servlet engine (Tomcat) and takes care of configuration of almost everything.
It doesn't require XML configuration which is a blessing and makes you feel like 2017, not 2000.
I found this video tutorial a very useful one and I can recommend it to you:
https://www.youtube.com/watch?v=vgPkUVF862g
Also, this series of video tutorials is excellent and explains everything about Spring MVC and Spring Boot, but it seems that first video is missing..
https://www.youtube.com/watch?v=C3ZrOj4unss

Finished Java project, now creating jar or .exe file (with Database)

So, i've just finished a small java application, with database and stuff...
I used Netbeans and Mysql, now i want to export my project so i can use it anywhere i want;
any computer, even with no Mysql or Java installed!
So, i've tried some programs like Launch4j or something... but the main problem is, even if i make the .exe file, what's gonna happen with the database? it's located in my PC, so if somebody try to use my application, he can't access to the database, so the application won't work...
In other words...What is the solution that i can use to like "Combine" the database with the application, if it is possible? or create the .exe file with the database...
I hope that my problem is clear, and thank you for your answers :)
You can look at MySQL Connector/MXJ to embed your mysql database in your application.
But be aware that this package is no longer under active development:
Due to very low demand, MySQL
has stopped development and support for Connector/MXJ. Source and
binaries for previously released versions will continue to be
available from archives.
An alternative solutation would be using another database like SQLite, H2 or HSQLDB
You can create an executable jar by exporting your project through eclipse. You can do this by following these steps:
Right click on the Project
Export as Jar file
When you were programming in netbeans did you include the database within netbeans? Here is a guide on how to do this.
https://netbeans.org/kb/docs/ide/mysql.html
Also here is a second guide on how to Packaging and Distributing Java Desktop Applications
https://netbeans.org/kb/docs/java/javase-deploy.html
I hope these help.
If not just go over your step you took to build the app.
if you really want to give your users a good experience, I would suggest you implement a embedded database in your application instead.
Look at: http://www.h2database.com/
It's free and open source and I use it heavily myself.
It supports embedded (where it creates flat database files on the computer), in-memory, and server-mode, where you have the possibility of letting multiple-applications share the same database.
It's just a jar file you include in your application, and then the users wont have to install neither MySQL, have access to MySQL on a network drive or need other database software installed.
(depending on your requirements, it might also be a good idea to look into Hibernate, to have some more abstraction between the different RDBMS).
In order to get a database built-in to the application, consider HSQLDB, which is an in-memory database.
http://hsqldb.org/
It can run entirely in the JVM without any external resources.

How to configure mySQL on Eclipse EE (Java)

Downloaded:
Java EE
Eclipse Indigo EE
mySQL 5.5
From this point I have no idea about how to create a mySQL database directly from eclipse. I've found methods which employ WAMP servers, however I'm not aiming to do it that way.
I believe that the first step lies in somehow configuring mySQL with eclipse/java, but I'm kind of lost at this point, I have no idea on how to proceed.
Note: Given that I'm a beginner to this field of CS, my question might lack necessary details, thus if you feel that way then please let me know, I'll edit my question with more details.
Thankyou.
If more help needed, here's a pictuto that's very clear and goes step by step :
http://books.zkoss.org/wiki/Setup_MySQL_DB_in_Eclipse
Take a look at the following links :
http://forums.mysql.com/read.php?39,91363,91363
http://obscuredclarity.blogspot.com/2009/08/setup-mysql-development-in-eclipse.html
http://www.classes.cs.uchicago.edu/archive/2006/spring/10200-1/mysql/JDBC.pdf
From here :
how to use a MySql database within Eclipse (Specifically this answer)
Try this plugin for eclipse. Works with all oracle/mysql/postgre.
No need of external ide like SQLyog for db operations/queries...
click here to get Toad Plugin for eclipse

From Matlab to the web

I have big project in Matlab with some pretty complicated GUI. I'd like to put it on my apache server. The idea is: people should've access to it without downloading anything (I mean something like Java applet or web app). I've managed to create a .jar file by using the deploytool but I'm not sure it's the right way. I've read mathworks tutorial, but in the example: http://www.mathworks.com/help/toolbox/javabuilder/ug/bsqrikz-26.html they're using some piece of JavaCode which I don't really know where they got it from. In the end I've created a .war file but the apache sees it only as an archive, not as an application, so clearly I did something wrong.
So, could someone tell what I have to do step-by-step to create a web application from my Matlab code, please?
Thx!
There are a number of webinars by MathWorks showing how. Here is the most recent one I could find:
Application Deployment with MATLAB
For reference, there is a page listing all the options for deploying MATLAB on the web.

Categories