Java server that queries mysql database

568 Views Asked by At

I have a server that has a mysql database. I want my client-side java application to query if the user is in the database (to give them access to the rest of the application). Ideally, I want my client-side app to communicate to a server-side app (same server where mysql db is stored) that will take this query, query the db and send the query results back to the client.

I understand this can be done using Java ServerSockets, and I think I have an idea on how to do this, but before I continue I'd like to know if there is a framework that already does this? Maybe something I can simply run on my server that will listen for these queries from clients and send the result to the client. Basically, does this solution already exist so that I do not have to build the application myself?

This is all new to me and I'd like to deploy this system as soon as possible. I know building it on my own will take a while (especially if I want it to be security conscious), so I'd like to save time where I can with pre-existing tools. Btw, I'm using an AWS EC2 VM running Ubuntu. I've already got the mysql db installed and running on localhost.

Any advice is welcomed,

Thanks

2

There are 2 best solutions below

0
PendingValue On

Try to read on how to use JDBC (note that JDBC is specific to the database system, so in your case, search for JDBC for MySQL )

0
Anand Vaidya On

Just check out if this can be of your help. http://www.manageability.org/blog/stuff/jdbc-proxy-drivers/view

SSL-SQL-Proxy Server – The goal was to develop a server, that works as a proxy server, to forward SQL-Queries using SSL. The server was supposed to be mostly platform independent, and after some considerations, Java was the language of choice. The proxy-server accepts SSL-secured connections over TCP/IP, and reads the request using a specified protocol. Then the proxy-server uses a JDBC-Driver to connect to the database and forward the query, getting the result and transfer the result back to the client via SSL.