sample code for the java to database connections