This repository Java_MySQL_Connectivity contains instructions for testing Java MySQL Connectivity using JDBC. Files to run (in src): Main.java : Program for testing Java MySQL Connectivity using JDBC NewMain.java : Program to create a table in user specified MySQL Database and insert two rows.
MAKE SURE YOU HAVE MySQL INSTALLED IN YOU SYSTEM!
Step 1: Download IntelliJ IDE by Jet Brains https://www.jetbrains.com/idea/download/?section=windows
Choose .exe (Windows) and click Download
Run the .exe file.
NOTE: Do not forget to choose add to PATH while installing!
Download JDBC https://dev.mysql.com/downloads/connector/j/
Choose Operating System as Platform Independent.
Choose the .zip option
Extract the file and save it in the Desktop.
Download this repository Java_MySQL_Connectivity. Extract the zip file. Open the folder JAVA_MySQL with IntelliJ IDE.
Hit Ctrl+Alt+Shift+S. In the Dialog Box, on the left side click on Modules, then click on Dependencies, on the + Symbol. Select option 1, JAR or Directories. Navigate to the file, the JDBC file mysql-connector-j-9.5.0 Select the file mysql-connector-j-9.5.0.jar.
Before running the program make sure you have entered the database name and MySQL Password. Run the program file Main.java in src folder. If you get the output as
You are now connected to MySQL. IntelliJ is communicating with MySQL. Congrats! You now have a working Java with MySQL Backend.
Check the NewMain.java file The program NewMain.java in src folder contains code for creating a table in user specified MySQL database and insert two entries. Run the file and if you get the output as
You have created a table >users in the database that you have specified and two entries have been inserted.
You can also verify the table created in MySQL Client.

NOTE: You must only run this program once as running it the second time causes errors, since the data will be duplicated.
The code is generated with the help of Google Gemini.