I'm working on a simple Java desktop application that will connect to a MySQL database hosted online. The app should allow users to create accounts, and I need to implement basic database operations like SELECT, INSERT, and UPDATE. Given that this isn't a critical project, I'm focusing more on simplicity rather than security, but I want to avoid making it easy for anyone to tamper with the database. Is it safe to connect directly to the database from the client side, or do I need a backend? If a backend is necessary, what are the easiest solutions to implement without hosting on my own machine?
3 Answers
It’s generally a bad idea for a desktop app to directly communicate with a remote MySQL database. Your credentials could be exposed and malicious users could tamper with your data. For a simple backend, consider using frameworks like Spring Boot, Node.js, or Flask, and host them on platforms like Render or Railway. This keeps things manageable and secure.
Connecting directly to the database from the client side is definitely not safe. You should always implement a backend to handle the database interactions. This way, you can validate client requests and ensure that your database credentials aren’t exposed. Even if this project is small, having that layer of security is essential.
Never allow clients to connect directly to your database. It's just too risky—your database credentials could be compromised, and people could easily interfere with your data. Always implement a backend layer for protection.

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically