  // written by:Eric Lee
  // tested by: Eric Lee
  // debugged by: Eric Lee

package com.example.stockprophit;

import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

import android.os.AsyncTask;
import android.util.Log;

public class sqlstuff extends AsyncTask {
	
	@Override
	protected Object doInBackground(Object... arg0) {
		try{
			Class.forName("com.mysql.jdbc.Driver").newInstance();
			String uname = "root";
			String pword = "marsic452root";
			String dburl = "jdbc:mysql://172.16.69.11:3306/SP?user=" + uname + "&password=" + pword;
			java.sql.Connection dbconnection = DriverManager.getConnection(dburl);
			
			Statement stathandle = dbconnection.createStatement();
			String query = "Select * from userlogin";
			ResultSet result = stathandle.executeQuery(query);
			while(result.next())
			{
				System.out.println("Users:" + result.getString("Username"));
			}
		}catch(Exception e){
			Log.e(LoginActivity.class.toString(), e.getMessage());
		}
		return null;
	}
}
