This project demonstrates how a Java application connects to a MySQL database using JDBC (Java Database Connectivity) to retrieve and display data from a database table.
The application establishes a database connection, executes an SQL query, and prints the retrieved records in the console.
This task was completed as part of an internship assignment to gain practical experience in backend development and database integration.
- Build a Java application that connects to a MySQL database
- Retrieve data from a database table using JDBC
- Display the retrieved data in the console
- Java
- JDBC (MySQL Connector/J)
- MySQL
- Eclipse IDE
- Git & GitHub
- Database Name:
testdb - Table Name:
students
| Column | Data Type |
|---|---|
| id | INT (Primary Key) |
| name | VARCHAR |
| age | INT |
- Establishes a connection to the MySQL database using
DriverManager - Executes a
SELECTSQL query on thestudentstable - Retrieves records using
ResultSet - Displays the retrieved data in the console
- Properly closes all database resources to avoid memory leaks
- Remove spaces and special characters before checking
- Use two-pointer technique instead of reversing the string
- Extend functionality to check sentences and phrases