A comprehensive Java-based Library Login System that manages student registrations, logins, and provides detailed analytics for administrators. The system includes a user-friendly GUI and a robust MySQL database backend.
- β Student Registration with ID, Name, Course, and Year Level
- β Student Login Authentication
- β Login History Tracking
- β Semester Selection
- β Admin Login Authentication
- β View All Student Logins
- β
Advanced Analytics & Sorting:
- Sort by Department (Course)
- Sort by Semester
- Sort by Department & Semester Combined
- View Total Login Counts
- Oldest/Newest First Sorting
- Alphabetical Sorting (A-Z, Z-A)
- β Export Data to CSV and TXT formats
- β Real-time Data Persistence
- β Automatic Analytics Update
- β Department Login Statistics
- β Semester Login Statistics
- β Combined Department & Semester Analytics
- β Persistent Data Storage
-
students - Student information
- student_id (Primary Key)
- student_name
- course (department)
- year_level
-
login_logs - Login history
- log_id (Primary Key, Auto-increment)
- student_id (Foreign Key)
- student_name
- course
- year_level
- semester
- login_datetime
-
admin_info - Admin credentials
- id
- admin_id
-
analytics_by_department - Department analytics (NEW)
- analytics_id
- department
- login_count
- last_updated
-
analytics_by_semester - Semester analytics (NEW)
- analytics_id
- semester
- login_count
- last_updated
-
analytics_by_dept_semester - Combined analytics (NEW)
- analytics_id
- department
- semester
- login_count
- last_updated
- Java JDK 11 or higher
- MySQL Server 10.4 or MariaDB
- MySQL Connector/J JDBC Driver (included in lib/)
-
Clone the Repository
git clone https://github.com/mjslm/SDF-LLS-PROJ.git cd SDF-LLS-PROJ -
Create Database
mysql -u root -p < library_login_system_database.sqlThis will create:
- Database:
library_login_system_database - All required tables
- Sample data
- Database:
-
Configure Database Connection (if needed) Edit
database/DBUtil.java:private static final String URL = "jdbc:mysql://localhost:3306/library_login_system_database"; private static final String USER = "root"; private static final String PASSWORD = "your_password";
-
Compile and Run
./run.bat
Or manually:
javac -d . $(find . -name "*.java") java Main
- Open Admin Dashboard after logging in with ID:
ADMIN123 - Use the Sort dropdown to view:
- All Logs - Complete login history
- Newest/Oldest First - Time-based sorting
- A-Z / Z-A - Alphabetical sorting
- By Department - Total logins per course/department
- By Semester - Total logins per semester
- By Department & Semester - Detailed breakdown
========== LOGIN COUNT BY DEPARTMENT ==========
Department: BSIT | Total Logins: 28
Department: BSCrim | Total Logins: 12
========== LOGIN COUNT BY SEMESTER ==========
Semester: 1st Semester | Total Logins: 25
Semester: 2nd Semester | Total Logins: 15
All analytics are automatically saved to the database when:
- Exporting to CSV
- Exporting to TXT
- Using sorting features (triggered by admin dashboard)
The system uses INSERT ... ON DUPLICATE KEY UPDATE to ensure:
- β No duplicate entries
- β Always up-to-date statistics
- β Automatic timestamp tracking
SDF-LLS-PROJ/
βββ Main.java # Application entry point
βββ run.bat # Batch file to compile & run
βββ library_login_system_database.sql # Database schema
βββ README.md # This file
β
βββ database/
β βββ Database.java # Database operations & analytics
β βββ DBUtil.java # JDBC connection utility
β
βββ gui/
β βββ MainMenuGUI.java # Main menu interface
β βββ StudentLoginGUI.java # Student login form
β βββ StudentRegisterGUI.java # Student registration form
β βββ AdminLoginGUI.java # Admin login form
β βββ AdminDashboardGUI.java # Admin dashboard with analytics
β
βββ models/
β βββ Student.java # Student data model
β
βββ users/
β βββ User.java # Base user class
β βββ StudentUser.java # Student user implementation
β βββ AdminUser.java # Admin user implementation
β
βββ lib/
β βββ (MySQL JDBC Driver)
β
βββ exported/
βββ analytics.csv # Exported CSV data
βββ analytics.txt # Exported TXT data
- ID:
ADMIN123 - Password: (configured in Database.java)
- ID:
2023-00194 - Name: Zita Miro M. Valerio
- Course: BSIT
- Year: 2
// Update analytics in database
updateAnalyticsByDepartment() // Save department stats
updateAnalyticsBySemester() // Save semester stats
updateAnalyticsByDeptAndSemester() // Save combined stats
updateAllAnalytics() // Update all analytics
// Retrieve analytics for display
getLoginCountByDepartment() // Get department breakdown
getLoginCountBySemester() // Get semester breakdown
getLoginCountByDepartmentAndSemester() // Get combined breakdownStudent Login
β
[logLogin() called]
β
[Data saved to login_logs table]
β
[Admin Dashboard displays]
β
[Admin clicks Sort/Export]
β
[updateAllAnalytics() triggered]
β
[Analytics computed and saved to:
- analytics_by_department
- analytics_by_semester
- analytics_by_dept_semester]
β
[Data exported to CSV/TXT]
β Error: Unknown database 'library_login_system_database'
Solution: Import the SQL file to create the database:
mysql -u root -p < library_login_system_database.sqlβ Error: Communications link failure
Solutions:
- Verify MySQL is running
- Check DBUtil.java database credentials
- Verify localhost:3306 is correct
# Clean and recompile
rm *.class
rm */*.class
javac -d . $(find . -name "*.java")- β¨ Added analytics storage to database
- β¨ New analytics tables for department and semester tracking
- β¨ Automatic data persistence on export
- β¨ Enhanced Admin Dashboard with 8 sorting options
- π Fixed GUI syntax errors
- π Added comprehensive README
- Initial release with basic login system
- Student registration and login
- Admin dashboard with basic log viewing
- CSV/TXT export functionality
- Marchael Shesh (mjslm)
- Miro Valerio
For issues or feature requests, please contact the development team.
This project is provided as-is for educational purposes.
Last Updated: December 8, 2025