You might find it helpful to read a couple of books:
"Database Programming with JDBC & Java"
The first book contains plenty of examples of Java techniques, such as
opening a file and reading it a line at a time.
The second book focusses on database programming with Java.
You should then read the doentation about Connector/J, the JDBC
library for MySQL:
This provides advice about how to obtain and install the latest version
of Connector/J, and examples showing how to connect to MySQL and send
commands and queries to the MySQL server.
In a recent thread on this subject, Jeff Summers also recommended "MySQL
and Java Developers Guide" by Matthews, Cole, and Gradecki, from Wiley.
Mark Matthews is the principal developer of Connector/J, so you'll be
learning from the expert.
Good luck with your project.