I recommend reading how to use statement and how to use PreparedStatements
Processing SQL Statements with JDBC (The Java™ Tutorials > JDBC(TM) Database Access > JDBC Basics)
Using Prepared...