Hi. Following is a nice tutorial about how to connect to a database from Java (using JDBC):

Connect to a database with JDBC