get Connect mysql

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;

import android.app.Activity;
import android.os.Bundle;
import android.widget.Toast;

public class sampleActivity extend Activity {
	@Override
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceSate);
		setContentView(R.layout.main);

		try {
			Connection con = MySqlConnect.getConnection();
			Statement stmt = (Statement) con.createStatement();

			String mySql = "select date from table;";
			ResultSet rs = stmt.executeQuery(mySql);

			while(rs.next()){
				Toast.makeText(getApplicationContext(), rs.getString("date"), Toast.LENGTH_LONG).show();

			}

			rs.close();
			stmt.close();
			con.close();
		} catch(Exception e){
			
		}
	}
}
import java.sql.*;

class MySqlConnect{
	static Connection getConnection() throws Exception {

		Class.forName("com.mysql.jdbc.Driver");

		String url = "jdbc:mysql://xxx.xxx.xxx/db_name";
		String user = "user_name";
		String pass = "password";

		Connection con = DriverManager.getConnection(url, user,pass);
		return con;
	}
}