MySQL
MySQL is an open-source RDBMS (relational database management system) used to modify, create and extract data from databases. Databases are essential for storing large data. It supports cross-platform, full-text indexing and uses triggers, views and cursors. MySQL Workbench is the integrated environment provided by the MySQL database.

So, now let’s start connecting to MySQL from the Vaadin application.
Connecting to MySQL
For CRUD operation in our web application, we use the MySQL database. So here we will learn about Connecting to MySQL

Step 1: The very first thing we need to do is to download and install MySQL. Then start the MySQL server.
Step 2: Open your project in your favourite IDE (say, Visual studio). We can run our project, say Vaadin application with Spring Boot using the command:
mvn spring-boot:run
Step 3: Make sure to start the local web server, here tomcat. Cross-check it by opening http://localhost:8080. You can see your application at this address.
Step 4: Now, let’s start connecting to MySQL:
Enter your database address and your credentials, including username and password for the database. For this, you have to open application.properties file and here type the following command.
spring.datasource.url = jdbc:mysql://localhost:3306/
spring.datasource.username = USERNAME
spring.datasource.password = PASSWORD

You can also try this code with Online Java Compiler
Run Code
Step 5: make sure to add mysql-connector-java dependency and spring-boot-starter-jdbc dependency to the pom.xml file. These dependencies are added under the tag <dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>

You can also try this code with Online Java Compiler
Run Code

Frequently Asked Questions
Is Vaadin an example of the Js framework?
No, Vaadin itself is an open-source web framework in which we can develop an application without the use of HTML and CSS.
Is Vaadin stateless?
Yes, this server is stateless and allows instances to be horizontally scaled, and the services are highly available.
Is Vaadin free?
Yes, Vaadin is an open-source framework, and we can use it for free for both commercial and non-commercial purposes.
How can we add Javascript to Vaadin?
We can easily add Javascript to Vaadin using the following two methods:
(i) Using Annotations (ii) Using Page objects.
Conclusion
In this article, we have clearly discussed Vaadin and MySQL and how they can be connected to one another. Along with a clear understanding of connecting to MySQL, we also covered some frequently asked questions.
Recommended Readings:
After reading about Connecting to MySQL, are you not feeling excited to read/explore more articles on Database management Systems? Don't worry; Coding Ninjas has you covered. See DBMS guided path to learn. Also feel free to see and learn Java, Spring MVC, GWT vs Vaadin, and Spring Boot to learn.
Do upvote our blogs if you find them helpful and engaging!
Happy Learning!
