Java + SQL? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Java + SQL?

My dad works the machines at Aqua Römer and he was told that they'd need a program to note down all the bottles they've filled. For example: 12/5/2017 03:23 Orange Lemonade 3000 Would this be possible using Java and SQL? How do I join those two even?

24th May 2017, 10:49 AM
Halbes Dextro
Halbes Dextro - avatar
7 Answers
+ 4
You'll need a JDBC connection for that: https://www.tutorialspoint.com/jdbc/jdbc-sample-code.htm JDBC acts as a "bridge" between a Java application and a database. You can write a SQL sentence on Java, pass it through the JDBC bridge, and retrieve the resulting records back into Java.
24th May 2017, 11:36 AM
Álvaro
+ 3
strongly suggest in you to drop the jdbc and learn hibernate (object/relational mapping), as you project grow jdbc will become harder to maintain.
24th May 2017, 1:44 PM
Keshave Jat
Keshave Jat - avatar
+ 2
use hibernate it will ease you a lot. it will be just one time pain to write Hibernate class but in the rest of the project you can use it like a normal Java object and Hibernate will do all the query work for you.
24th May 2017, 2:49 PM
Keshave Jat
Keshave Jat - avatar
+ 1
@Keshave Jat: sorry, I had heard of Hibernate, but I haven't worked with it. Maybe this tutorial can be helpful: https://www.tutorialspoint.com/hibernate/
24th May 2017, 2:45 PM
Álvaro
+ 1
Sounds great, @Álvaro, i will look into it.
24th May 2017, 2:50 PM
Halbes Dextro
Halbes Dextro - avatar
0
It will not be a giant project, just an SQL database on a server accessible through different java applications. I doubt it will become very complicated.
24th May 2017, 2:47 PM
Halbes Dextro
Halbes Dextro - avatar
0
By the way with Hibernate you may use JpaRepository. It will be a lot easy for you.
3rd Jul 2020, 11:02 AM
Юрий Федоров
Юрий Федоров - avatar