{
  "id": 5964316,
  "title": "Online Voting System in my facing challenges.....",
  "url": "https://urgent.news/2026/09/06/online-voting-system-in-my-facing-challenges",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-06T11:14:11.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/abineshrajendiran/online-voting-system-in-my-facing-challenges-with-answer-pmh"
  },
  "original_language": "en",
  "account": "The online voting system is encountering several technical challenges that need to be addressed. The primary issue is establishing a connection to the MySQL database, which is causing communication failures. This appears to be due to an incorrect JDBC URL format or missing parameters in the connection string. The developer resolved this by ensuring the correct URL format, including the `useSSL=false` and `serverTimezone=UTC` parameters, and properly adding the MySQL driver JAR to the classpath.\n\nAnother significant challenge is preventing users from casting duplicate votes. The developer addressed this by adding a `has_voted` boolean column to the voters table. Before a user can cast a vote, the system checks this flag in a database query. If the user has already voted, the vote is not accepted. Additionally, a UNIQUE constraint was implemented at the database level to prevent duplicate entries, serving as a backup to the application logic.\n\nThe developer initially had scattered database queries in their main class, making it difficult to test and maintain. To improve code organization, they refactored the system into a DAO (Data Access Object) pattern. The final structure includes separate DAO interfaces and implementation classes for handling voter verification, candidate data, vote casting and counting, and managing database connections. This separation allows for easier debugging and future database swapping with minimal code changes.\n\nLastly, when generating the final vote results, the developer faced an issue with incomplete or garbled output due to improper handling of the file writer. The problem was resolved by using a `BufferedWriter` with a `try-with-resources` statement, which automatically closes the writer after the code block is executed, ensuring that all data is properly written to the file.",
  "summary": "1. JDBC Connection & SQL Errors My first roadblock wasn't even logic — it was just getting connected. I kept hitting: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure ** What was going wrong:** Wrong JDBC URL format (missing useSSL=false or timezone parameter caused issues on newer MySQL versions) MySQL service not running Driver JAR not added to the classpath…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}